我想在jsGrid中使用客户端过滤,并实现了
same controller as in hidden code
在演示页面中数据库js文件)但我遇到了一个showstopper:过滤器行不显示,即使我添加了一个控制字段(我不想)来切换它。
function initGrid() {
dom_accountList.jsGrid( {
height: 500,
width: '100%',
autoload: true,
filtering: false,
editing: false,
sorting: true,
paging: true,
pageSize: 25,
pageButtonCount: 5,
fields: accountList.layout,
controller: accountList,
data: accountList.data,
rowClick: function (arg) {//redacted}
});
dom_accountList.jsGrid("option", "filtering", true);
}
您可能会想纠正的附带问题:
-
-不,由
反复试验我发现
loadData
-
-我知道。无论定义中为true、在定义中缺少还是在定义中为false,然后在渲染后切换(如图所示),这些字段都不会在屏幕上呈现。
<tr class="jsgrid-filter-row" style="display: table-row;">
<td class="jsgrid-cell" style="width: 10px;"></td>
<td class="jsgrid-cell" style="width: 65px;"></td>
<td class="jsgrid-cell" style="width: 10px;"></td>
<td class="jsgrid-cell" style="width: 10px;"></td>
</tr>
不应该有吗
input
他们为什么不见了?
我想这就是问题的症结所在。
function loadData(filter) {
return $.grep(this.data, function (item) {
return (!filter.Account || item.Account.indexOf(filter.Account) > -1)
&& (!filter.AXfer || item.AXfer === filter.AXfer)
&& (!filter.BXfer || item.BXfer === filter.BXfer)
&& (!filter.Name || item.Name.indexOf(filter.Name) > -1)
});
};
function insertItem() {};
function updateItem() {};
function deleteItem() {};
accountList.layout = [
{
name: 'Account',
title: 'Account',
width: '10',
},
{
name: 'Name',
title: 'Name',
width: '65',
},
{
name: 'AXfer',
title: 'ATeam',
width: '10',
},
{
name: 'BXfer',
title: 'BGood',
width: '10',
];
}