简体   繁体   English

将验证添加到EXT-JS 4.1 GridPanel中的过滤器文本字段?

[英]Add validation to a filter textfield in an EXT-JS 4.1 GridPanel?

I have an EXT-JS grid panel with remote filtering: 我有一个带有远程过滤功能的EXT-JS网格面板:

Ext.define('My.GridPanel', {
   extend: 'Ext.grid.Panel'

   ...

   features: [{
      ftype: 'filters'
      encode: true,
      local: false
   }],
   initComponent: function() {
      ....

   .....
});

How can I add validation to the textfield that's created which allows you to enter the filtering criteria? 如何将验证添加到创建的文本字段中,以允许您输入过滤条件?

What I want to do is disallow certain characters that are causing bad things to happen on the server side. 我要做的是禁止某些导致服务器端发生不良情况的字符。

You can use a searchfield and verify its value before sending it 您可以使用搜索字段并在发送前验证其值

dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    height : 30,
                    items: [
                        {
                            xtype: 'searchfield',
                            width: 400,
                            fieldLabel: 'Search ',
                            labelWidth: 60,
                            store: gridStore,
                            listeners:{
                                change:function(element, value){
                                    console.log(value);
                                    }
                                }
                        }
                                          ]
                               }
               ]

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

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