当columnDefs具有字段作为类型编号时,Angular ui网格按字符串过滤.为什么?

Jon*_*edy 8 django grid user-interface angularjs angular-ui-grid

我正在使用django 1.8,angularjs 1.3.14和jquery 1.11.0.

这是在Controller/gridOptions/columnDefs中.

{ field: 'credit_amt',                
  displayName: 'Credit Amount',           
  type: 'number', 
  width: '8%',   
  enableFocusedCellEdit: true, 
  visible:true,
  //This 'filters' is the sort box to do the search.
  filters: [{   
            condition: uiGridConstants.filter.GREATER_THAN,
            placeholder: 'greater than'
          }
Run Code Online (Sandbox Code Playgroud)

请注意,'type'是一个数字.当我运行此程序时,程序将此字段视为字符串而不是数字.因此排序不能按照我需要的方式运行.
我试图省略'type'并让它自动检测数据类型. - 不行.

以下是使用前后的排序:

在添加搜索项之前

只需在搜索字段中添加6即可

如您所见,当没有数据小于6时,项目被过滤.请帮忙.谢谢.

Qi *_*ang 4

您可以使用自己的条件函数

condition: function(term, value, row, column){
   if(!term) return true;
   return parseFloat(value) > parseFloat(term);
}
Run Code Online (Sandbox Code Playgroud)