Extjs 6.5.3 从记录值中绑定隐藏的 widgetcolumn 属性

Extjs 6.5.3 Binding hidden property of widgetcolumn from record values

我想 show/hide 网格的 widgetcolumn 和我的 属性 记录。

我尝试通过绑定我的值来做到这一点:

{
    xtype: 'grid',
    bind: {
        store: 'ActionList'
    },
    border: true,
    flex: 2,
    name: 'actionList',
    title: this.titleActionGrid,
    columns: [{
        xtype: 'widgetcolumn',
        height: 50,
        width: 65,
        widget: {
            xtype: 'button',
            text: '{sActionTitle}',
            scale: 'large',
            height: 45,
            width: 45,
            margin: 5
        },
        bind: {
            hidden: '{bIsHidden}'
        }
    }]
}

那没有用,所以我在互联网上搜索并找到这个 fiddle:https://fiddle.sencha.com/#view/editor&fiddle/22rl

所以我用这部分代码试了一下:

cell: {
    tools: {
        up: {
            bind: {
                hidden: '{record.bIsHidden}'
            }
        }
    }
}

但这没有用,事实上 fiddle 是现代的,而我的代码是经典的..

我没有找到其他任何东西,这就是我来这里的原因,恳求任何人帮助我 ;)

提前致谢。

ExtJS 经典版 6.5.3

你可以这样绑定:

Ext.create('Ext.grid.Panel', {
     renderTo: Ext.getBody(),
     store: store,
     border: true,
     flex: 2,
     name: 'actionList',
     title: this.titleActionGrid,
     columns: [{
             dataIndex: 'id',
         },
         {
             xtype: 'widgetcolumn',
             height: 50,
             width: 165,
             dataIndex: 'hide',
             widget: {
                 bind: {
                     text: '{record.id}',
                     hidden: '{record.hide}'
                 },
                 xtype: 'button',
                 scale: 'large',
                 height: 45,
                 width: 155,
                 margin: 5
             }
         }
     ]
 });

您可以使用 rowViewModel 按记录绑定小部件列。 Fiddle:

Ext.application({
    name: 'Fiddle',

    launch: function () {
        new Ext.grid.Panel({
            renderTo: document.body,
            viewModel: {
                data: {
                    actionTitle: 'Remove'
                }
            },
            store: {
                data: [{
                    name: 'A',
                    hidden: false
                }, {
                    name: 'B',
                    hidden: true
                }]
            },
            rowViewModel: true,
            columns: [{
                dataIndex: 'name',
                text: 'Name'
            }, {
                xtype: 'widgetcolumn',
                widget: {
                    xtype: 'button',
                    bind: {
                        text: '{actionTitle}',
                        hidden: '{record.hidden}'
                    },
                    margin: 5
                },
            }]
        });
    }
});