【发布时间】:2020-06-27 11:39:04
【问题描述】:
我在尝试使用 datagrid-filter 在表内的列中实现精确匹配搜索时遇到问题。
例如: 如果我搜索“名称 1”,则在 名称 列下,搜索结果将仅显示名称 1。 谁能教我怎么做? 非常感谢您的帮助。
$(function(){
var rows = [];
for(var i=1; i<=800; i++){
var amount = Math.floor(Math.random()*1000);
var price = Math.floor(Math.random()*1000);
rows.push({
inv: 'Inv No '+i,
date: $.fn.datebox.defaults.formatter(new Date()),
name: 'Name '+i,
amount: amount,
price: price,
cost: amount*price,
note: 'Note '+i
});
}
$('#tt').datagrid({
view : scrollview,
striped : true,
pagination : false,
pageSize : 50,
singleSelect : false,
autoRowHeight: false,
remoteFilter : false,
remoteSort : true,
multiSort : true,
});
$('#tt').datagrid('enableFilter', [{
field:'amount',
type:'numberbox',
options:{
precision:0
},
op:['equal','notequal','less','greater']
}])
$('#tt').datagrid('loadData', rows);
});
请参考这个jsfiddle: http://jsfiddle.net/6u2b8pyp/
【问题讨论】:
标签: javascript jquery datagrid