代码之家  ›  专栏  ›  技术社区  ›  user1944491

js网格过滤器不呈现

  •  0
  • user1944491  · 技术社区  · 7 年前

    我想在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);
      }
    

    您可能会想纠正的附带问题:

    1. -不,由 反复试验我发现 loadData
    2. -我知道。无论定义中为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',
       ];
     }
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   user1944491    7 年前

    哦,天哪,在这之后,答案是:有必要包括 type

      {
        name: 'Account',
        title: 'Account',
        width: '10',
        type: 'text',
      },
      {
        name: 'Name',
        title: 'Name',
        width: '65',
        type: 'text',
      },
      {
        name: 'AXfer',
        title: 'ATeam',
        width: '10',
        type: 'text',
      },
      {
        name: 'BXfer',
        title: 'BGood',
        width: '10',
        type: 'text',
      }