Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/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 Ext JS 6.5-禁用现代网格不工作_Extjs_Extjs6 Modern_Extjs6.5 - Fatal编程技术网

Extjs Ext JS 6.5-禁用现代网格不工作

Extjs Ext JS 6.5-禁用现代网格不工作,extjs,extjs6-modern,extjs6.5,Extjs,Extjs6 Modern,Extjs6.5,我正在开发ExtJS6.5Modern。我有一些条件来禁用网格组件,用户只有查看网格的权限,其他人无权查看 我尝试过配置和方法,但不起作用。这是我的名片 代码片段 Ext.application({ name: 'Fiddle', launch: function () { Ext.create('Ext.data.Store', { storeId: 'gridStore', fields: ['name']

我正在开发ExtJS6.5Modern。我有一些条件来禁用
网格
组件,用户只有查看
网格
的权限,其他人无权查看

我尝试过配置和方法,但不起作用。这是我的名片

代码片段

Ext.application({
    name: 'Fiddle',

    launch: function () {
        Ext.create('Ext.data.Store', {

            storeId: 'gridStore',

            fields: ['name'],

            data: [{
                name: 'Test 1'
            }, {
                name: 'Test 2'
            }, {
                name: 'Test 3'
            }, {
                name: 'Test 4'
            }]
        });

        Ext.create({
            xtype: 'grid',

            layout: 'fit',

            fullscreen: true,

            title: 'Baisc grid example',

            store: 'gridStore',

            //Here I have put {disabled: true} but not working
            disabled: true,

            columns: [{
                text: 'Name',
                flex: 1,
                dataIndex: 'name'
            }],

            listeners: {
                childtap: function (grid, location, eOpts) {
                    alert('childtap');
                }
            },

            items: [{
                xtype: 'toolbar',
                items: {
                    xtype: 'button',
                    ui: 'action',
                    text: 'Disabled grid',
                    iconCls: 'x-fa fa-ban',
                    handler: function () {
                        //IT is also not working
                        this.up('grid').setDisabled(true);
                        this.up('grid').disable();
                    }
                }
            }]

            //renderTo:Ext.getBody()

        });
    }
});

有人请帮助我禁用
网格
组件的解决方案。

作为一种解决方法,我们可以使用
grid.setMasked(true)


以下是示例。

另一种方法是将
grid
hideMode
设置为
opacity
,然后将其设置为
hidden
this.up('grid').setHidden(true);

例如(编辑小提琴)

您还需要此css覆盖:

<style>
.x-hidden-opacity {
    opacity: 0.2 !important; //default is 0
    pointer-events: none;
}
</style>

.x-隐藏-不透明度{
不透明度:0.2!重要;//默认值为0
指针事件:无;
}

您可能需要向Sencha提交一个bug,并使用
if(grid.isDisabled())返回同时在您的childtap活动中。好的,我将报告sencha forumgood idea上的错误。我将在我的申请中应用这个。谢谢你的解决方案
<style>
.x-hidden-opacity {
    opacity: 0.2 !important; //default is 0
    pointer-events: none;
}
</style>