我希望CheckboxModel在呈现网格时全部显示:
这是我的代码:
sm = Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function (sm, selections) {
// Must refresh the view after every selection
sm.view.refresh();
}
}
})
网格:
{
xtype: 'gridpanel',
title: 'gridTitle',
selModel: sm,
store: my_store,
columns: {
items:[
..
]
}
}
答案 0 :(得分:2)
您可以使用网格的 afterrender 侦听器来选择所有行:
listeners:{
afterrender:function( thisObj, eOpts ){
var sm=thisObj.getSelectionModel();
sm.selectAll(true);
}
},
答案 1 :(得分:2)
afterrender
可能无效,请尝试afterlayout
:
// in your grid
listeners: {
afterlayout : function (thisObj, eOpts) {
thisObj.getSelectionModel().selectAll();
}
},
// ...