This leads on from my previous question .
I initialize a grid with a CheckBox Selection Model, however when I reconfigure the grid the Check Box Selection Model visaully dissapears.
What I want to do is dynamically add a CheckBox Selection Model to a grid after reconfiguring the grids columns, and visually display it.
I have tried something like this:
var sm = new Ext.selection.CheckboxModel();
grid.selModel = sm;
grid.doLayout();
This worked for me. SelectionModel dynamic flag
//dynamically change, true or false, as the case
selectionModel = true
var sm = {} // Selection Model
if (selectionModel){
sm = Ext.create('Ext.selection.CheckboxModel')
}
var grid = Ext.create('Ext.grid.Panel', {
selModel: sm,
frame: true,
store: store,
columns: columns,
// more code ....
})
Note that this was a bug that has recently been patched:
If you are using ExtJS4, just do a grid.getSelectionModel()
after your reconfiguration and see if it works.
You don't have to do anything with the returned value. (if it doesn't work, debug to see what is returned by this method. is it an instance of CheckboxModel
?)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.