剑道网格列可过滤模式:"Row"和"Menu"



对于剑道UI网格,可以选择将可过滤设置为行或菜单或两者兼而有之。我想知道是否可以将某些列设置为行(仅作为行),而其他列显示为菜单(仅作为菜单)。最好不要使用 css。

示例:我希望字段名称是行筛选器,而年龄是菜单筛选器

<script>
      $("#grid").kendoGrid({
  dataSource: ...
  filterable: { 
    operators: {
      string: {
        startswith: "Starts with",
        eq: "Exact Client Name",
        contains: "contains"
      },
      number: {
        gte: "From",
        lte: "Before"
    }
   },
   mode: "row" },
   column: [ { field: "ClientName", title: "Client Name", width: 150, type: "string" , attributes: { style: "text-align:left;" }, filterable: { messages: { info: "Show clients that: " }, extra: false} },
             { field: "Month", title: "Month", width: 78, type: "number", attributes: { style: "text-align:center;" }, filterable: { messages: { info: "Show month(s): ", and: "To" }, ui: monthFilter, mode: "menu" } }
   ]
 });
</script>

我想出了一个解决方案。可能不是最好的解决方案,但对于任何需要它以供将来参考的人,我使用了以下解决方案。将可过滤模式设置为模式:"行,菜单"

   filterable: {
      cell: { enabled: false}   
    }

以消除不需要的行筛选器。并使用 jquery

databinding: function(e){
     $("#grid-name .k-grid-filter .k-filter").css('display', 'none');
     $("#grid-name ").find("[data-field=Month]>.k-grid-filter .k-filter").css('display', 'block');
}

以消除不需要的列菜单过滤器。

最新更新