KendoUI网格 - 每列禁用一些过滤器运算符

时间:2014-12-01 10:24:50

标签: kendo-ui kendo-grid

我想每列禁用(或者可能定义一些自定义列表)运算符。 我尝试在列定义中执行此操作:

"field": "Name",
"title": "name",
"attributes": {
    "class": "nameCell"
},
"filterable": {
    "operators": gridTranslationService.getHierarchyOperators()
}

但它不适合我。任何sugestions我怎么能这样做?

1 个答案:

答案 0 :(得分:10)

status列定义设置为:

    columns: [
      {
        field: "status",
        filterable: {
          operators: {
            string: {
              eq: "Equal to",
              neq: "Not equal to"
            }
          }
        }
      },



$(document).ready(function() {
  $("#grid").kendoGrid({
    columns: [
      { field: "id", filterable: false },
      {
        field: "status",
        filterable: {
          operators: {
            string: {
              eq: "Equal to",
              neq: "Not equal to"
            }
          }
        }
      }
    ],
    filterable: true,
    dataSource: [ 
      { status: "error", id: 1 }, 
      { status: "warning", id: 2 },
      { status: "warning", id: 3 },
      { status: "warning", id: 4 }
    ] 
  });
});

<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.default.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.3.1119/js/kendo.all.min.js"></script>

<div id="grid"></div>
&#13;
&#13;
&#13;