Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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网格,只有两个actioncolumns和图标。如果IsApproved=true,如何设置渲染器以隐藏图标?我已尝试此操作。列[0]。项[0]。图标=“”;但获取此错误。未定义列 columns: [ { header: 'Name', dataIndex: 'Name', flex: 1 }, { header: 'Login', dataIndex: 'Login', flex: 1 },

我有一个EXTJS网格,只有两个actioncolumns和图标。如果IsApproved=true,如何设置渲染器以隐藏图标?我已尝试此操作。列[0]。项[0]。图标=“”;但获取此错误。未定义列

columns: [
                    { header: 'Name', dataIndex: 'Name', flex: 1 },
                    { header: 'Login', dataIndex: 'Login', flex: 1 },
                    { header: 'Registered', dataIndex: 'RegisteredOn', flex: 1 },
                    { header: 'Invited', dataIndex: 'InvitationSent', flex: 1 },
                    { xtype: 'actioncolumn',
                        width: 40,
                        header: 'Invite',
                        tdCls: 'clickable',
                        renderer: function (value, metadata, record) {
                            if (record.get('IsApproved')) {
                               //HIDE ICON
                            } else {
                                //SHOW ICON
                            }
                        },
                        items: [{
                            icon: '/images/icon_email.png',
                            tooltip: 'Invite',
                            scope: this,
                            handler: this.inviteClick
                        }]
                    },
                    { xtype: 'actioncolumn', width: 40, header: 'Edit', tdCls: 'clickable', items: [{
                        icon: '/images/pencil.png',
                        tooltip: 'Edit',
                        scope: this,
                        handler: this.editClick
                    }]
                    }
                ],

试试我的方法-如果您的条件为真,所以您将图标放在单元格中,在其他情况下,您不会:

                {
                    xtype: 'actioncolumn',
                    width: 70,
                    align: 'center',
                    dataIndex: 'yourDataIndex',
                    menuDisabled: 'true',
                    text: 'sometext',
                    sortable: false,
                    fixed: 'true',
                    renderer: function (value, metadata, record) {
                        if (record.get('IsApproved')) {
                            metadata.tdCls = 'mycss'
                        }
                    }
                }
并根据您的情况添加css:

.mycss {
    background-position:center  !important;
    width: auto !important;
    background-repeat: no-repeat;
    background-image: url("yourIcon.png") !important; 
}

这适用于隐藏图标。但联系行动仍然存在。(抱歉,没有提到链接也需要删除)。您:“但是链接操作仍然存在。”您的问题中的链接在哪里?使用处理程序:this.inviteClick在您的函数this.inviteClick您应该检查单元格值:如果(!record.get('IsApproved'))不执行任何操作)正确,但是我可以从该单元格中完全删除onclick,这样就没有手动光标或任何可点击的东西了吗?