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时,项目被过滤.请帮忙.谢谢.
您可以使用自己的条件函数
condition: function(term, value, row, column){
if(!term) return true;
return parseFloat(value) > parseFloat(term);
}
Run Code Online (Sandbox Code Playgroud)