如何限制用户键入剑道筛选器输入

How to restrict user to type in kendo filter input?

本文关键字:筛选 输入 何限制 用户      更新时间:2023-09-26

我在剑道网格上自定义了过滤器,但是当我在网格中有日期列时,我遇到了小问题,我想限制用户在过滤器输入中键入任何内容,预期行为是用户应始终从日期选择器中选择日期以应用过滤器。如何将键下功能应用于过滤器?

配置.js

getallCycles: {
        sortable: true,
        scrollable: true,
        editable: false,
        dataBound: function () {
        },
        filterable:{
          extra: false,
          operators: {
              string: {
                  startswith: 'Starts with',
                  eq: 'Is equal to',
                  contains: 'Contains'
              }
          }
      },
 columns: [
{
            field: 'assessmentDueDate',
            title: 'Cycle Assessments Due Date',
            width: '190px',
            filterable: {
              ui: function (element) {
                  'use strict';
                  element.kendoDatePicker({
                      format: 'yyyy-MM-dd'
                  });
                  element.onkeydown({
                    return false;
                  });
              },
              operators: {
                  string: {
                      eq: 'Is equal to'
                  }
              }
          }
          },
]
}

可以将禁用的属性添加到输入控件以禁用键入

filterable: {
  ui: function(element) {
    element.kendoDateTimePicker(); // initialize a Kendo UI DateTimePicker
    $(element).attr("disabled","disabled");
  }
}

请在此处观看现场演示