简体   繁体   English

在Ext Js的网格列菜单过滤器中限制输入值并启用特定字符

[英]Limit input values and enable specific characters in Ext Js' grid column menu filter

I have been using Ext Js' column menu number filter type to send actions for my backend to filter time values. 我一直在使用Ext Js的列菜单编号过滤器类型来为我的后端发送操作来过滤时间值。 For that, I would like the number type column menu filters to enable the ":" character, and/or limit the input values between 0 and 24. 为此,我希望数字类型列菜单过滤器启用“:”字符,和/或将输入值限制在0到24之间。

In case it is possible to include the ":" character, I would like to check for the 24 hours constraint only on the first two digits, or until the first ":" character. 如果可以包含“:”字符,我想仅检查前两个数字的24小时约束,或直到第一个“:”字符。

How can I make those modifications on the column menu? 如何在列菜单上进行这些修改?

This is the menu I am talking about: 这是我正在谈论的菜单:

数字列菜单

This is my mainViewPort (where the dateColumn is included) 这是我的mainViewPort(其中包含dateColumn)

ut: {
    type: 'fit'
},
controller: 'Queue',
enableTextSelection: true,
items: [
    {
        xtype: 'gridpanel',
        title: 'Autopilot Monitor',
        titleAlign: 'center',
        store: 'AutopilotQueueStore',
        id: 'grid',
        plugins: 'gridfilters',
        maxRows: 20,
        selModel: {
            selType: 'cellmodel',
            mode: 'SINGLE'
        },
        listeners: {
            filterchange: 'onFilterChangeAlt'
        },
        columns: [
            {
                xtype: 'gridcolumn',
                id: 'creationTime',
                align: 'center',
                dataIndex: 'creationTime',
                text: 'Time',
                filter: {
                    type: 'number',

                },
                minWidth: 90,
                flex: 0.8
            },
        ],
    }
]

}); });

You need to change column filter. 您需要更改列过滤器。 You can do something like: 你可以这样做:

filter: {
    type: 'list',
    single: true,
    options: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
}

Or do own filter type. 或者做自己的过滤器类型。

Check example on fiddle (custom filter type) : https://fiddle.sencha.com/#view/editor&fiddle/2rs2 检查小提琴上的示例(自定义过滤器类型): https//fiddle.sencha.com/#view/editor&fiddle/2rs2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM