Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ExtJS中自定义日期过滤器菜单_Extjs - Fatal编程技术网

在ExtJS中自定义日期过滤器菜单

在ExtJS中自定义日期过滤器菜单,extjs,Extjs,我被这个ExtJS网格日期过滤卡住了,非常感谢您的帮助 我的目标是删除Before和After子菜单项,只显示On项。更好的是删除整个子菜单,只显示datepicker 所以我的问题是,是否有可能删除这些项目,我如何才能做到这一点? 我尝试使用menuItems config menuItems:['eq'],这在视觉上是有效的,但当我从日期选择器中选择某个日期时,我收到此错误Uncaught TypeError:无法读取未定义的属性'up' 谢谢 onMenuSelect上的日期过滤器组件有问

我被这个ExtJS网格日期过滤卡住了,非常感谢您的帮助

我的目标是删除Before和After子菜单项,只显示On项。更好的是删除整个子菜单,只显示datepicker

所以我的问题是,是否有可能删除这些项目,我如何才能做到这一点? 我尝试使用menuItems config menuItems:['eq'],这在视觉上是有效的,但当我从日期选择器中选择某个日期时,我收到此错误Uncaught TypeError:无法读取未定义的属性'up'


谢谢

onMenuSelect上的日期过滤器组件有问题,如果选择on选项,它会尝试取消选择before和after菜单项,但在配置中删除了这些选项

我做了一点修改来解决这个问题:

    Ext.override(Ext.grid.filters.filter.Date, {

            onMenuSelect: function(picker, date) {
                var me = this,
                    fields = me.fields,
                    filters = me.filter,
                    field = fields[picker.itemId],
                    gt = fields.gt,
                    lt = fields.lt,
                    eq = fields.eq,
                    v = {};
                field.up('menuitem').setChecked(true, /*suppressEvents*/
                true);


                //The problem ocurrs here, i modified this line
                //if (field === eq) {
                //**********************************************
                if ((field === eq)&&(lt!=null)&&(gt!=null)) {

                    lt.up('menuitem').setChecked(false, true);
                    gt.up('menuitem').setChecked(false, true);
                } else {
                    eq.up('menuitem').setChecked(false, true);
                    if (field === gt && (+lt.value < +date)) {
                        lt.up('menuitem').setChecked(false, true);                           
                        if (filters.lt.getValue() != null) {
                            v.lt = null;
                        }
                    } else if (field === lt && (+gt.value > +date)) {
                        gt.up('menuitem').setChecked(false, true);                           
                        if (filters.gt.getValue() != null) {
                            v.gt = null;
                        }
                    }
                }
                v[field.filterKey] = date;
                me.setValue(v);
                picker.up('menu').hide();
            }
        });