ExtJ从widgetcolumn获取widget组件



我在一个窗口中有组件。第一列是一个带有复选框小部件的小部件列。我在这个专栏的模型中没有字段,这个专栏只是在我的视图中(Ext.grid.view).

我的小工具列

editGrid.columns.push({
            xtype: 'widgetcolumn',
            widget: {
                xtype: 'checkbox',
                listeners: {
                    change: function (checkbox, newValue) {
                        var checkedRecordId= checkbox.getWidgetRecord().getId();
                      //when checkbox click, add/remove record id in/from array.
                        if (newValue) {
                            editGrid.checkedEstimationIds.push(checkedRecordId);
                        } else {
                            Ext.Array.remove(editGrid.checkedEstimationIds, checkedRecordId);
                        }
                    }
                }
            }
        });

在分页之间,我想要获取复选框列(widgetcolumn)并根据数组、我的存储及其回调函数进行检查:

editGrid.store.on('load', function (store, records) {
        // checked boxes depend on checkedArrayIds
        // how get check boxes???
        for (i in records) {
            if (Ext.Array.contains(editGrid.checkedEstimationIds, records[i].id)) {
                //var row = editGrid.getView().getRow(parseInt(i),)//doesn't work;
                var gridView = editGrid.getView()
                var checkboxes = Ext.ComponentQuery.query('checkbox',gridView);

            } 
        }
    });

我想要得到这个列并检查它们是否依赖于一个id数组。如何获取extjs复选框组件?我试过了,但不起作用:

var gridView = editGrid.getView()
var checkboxes = Ext.ComponentQuery.query('checkbox',gridView);

更新

这个获取我的小工具专栏:

Ext.ComponentQuery.query('widgetcolumn',editGrid)

我在论坛中找到了onWidgetAttach(小部件,记录)。(它还没有在api文档中记录),所以:

      editGrid.columns.push({
                xtype: 'widgetcolumn', 
                onWidgetAttach: function (widget, record) {
                if (Ext.Array.contains(editGrid.checkedEstimationIds, records)) {                   
                  widget.setValue(true);
                 }   
                },
            widget: {
                xtype: 'checkbox',
                listeners: {
                    change: function (checkbox, newValue) {
                        var checkedRecordId= checkbox.getWidgetRecord().getId();
                        if (newValue) {
                            editGrid.checkedEstimationIds.push(checkedRecordId);
                        } else {
                            Ext.Array.remove(editGrid.checkedEstimationIds, checkedRecordId);
                        }
                    }
                },
            }
        });

最新更新