[2.1] "Smart" CheckBoxSelectionModel (v1.7 2008-07-01) - Ext JS Forums:: If set to true, * all other rows will be deselected and unchecked except the row .. and a CheckboxSelectionModel (header check all/uncheck all) and the http://yui-ext.com/forum/showthread.php?t=37588HOME | Hi there,
I tried to clear all selections in my grid by calling clearSelections().
But the header itself is not set unchecked by that function.
How can I do that?
Greetings
Bionique
Yes of course, but it calls deselectRow and deselectRow fires the selectionchange-event. That's why I suggested you to put the function into the listener config option of the selection model.
Please post your relevant code, that I can take a look on it.
But why do you want to set the header unchecked alone? In your first post you mentioned that you want to call 'clearSelections()'. JUST DO IT and the header becomes unchecked by the listener function. You don't need to handle the headercheckbox itself anymore.
Try it!
To clear all selections on load event use
yourStore.on('load', function() {
yourGrid.getSelectionModel().clearSelections();
});
or something like this...
In my app it works fine.
Can you post your code, please?
I didn't think about a smart solution. Just set the header property to an other value than the default one (empty div, empty string or something like this). 我的博客- liguisheng_002 - 网易博客:: 55 var sm = new Ext.grid.CheckboxSelectionModel(); // add checkbox column. 56 var cm = new Ext.grid.ColumnModel([nm,sm,. 57 {id:'PROJECT_NO',header:"项目 http://blog.163.com/liguisheng_002/HOME |
Create a new CheckboxSelectionModel like this one:
var sm = new Ext.grid.CheckboxSelectionModel({
listeners: {
'selectionchange': function() {
var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');
if (this.getCount() < this.grid.getStore().getCount()) { CheckboxSelectionModel: how to set header unchecked - Page 2 - Ext :: Page 2-CheckboxSelectionModel: how to set header unchecked Ext: Help. RowSelectionModel knows nothing about a header-field to set. http://extjs.com/forum/showthread.php?t=50266&page=2HOME | CheckboxSelectionModel: how to set header unchecked - Ext JS Forums:: CheckboxSelectionModel: how to set header unchecked Ext: Help. But what I want is to to set the header unchecked initially, after the store has been http://extjs.com/forum/showthread.php?t=50266HOME |
hd.removeClass('x-grid3-hd-checker-on');
} else {
hd.addClass('x-grid3-hd-checker-on');
}
}
}
});
Every time the selection changes, the function checks whether the headercheckbox should be checked or not.
The headercheckbox only becomes checked if all rows of your grid are checked, too.
So it becomes even checked if you select all rows manually.
Ok, now I understand. A hard peace of work... ;)
I tried your code for the selectionchanged, and it works. :)
Thank you very much for your effort and time.
CheckboxSelectionModel extends RowSelectionModel.
It seems to me that only RowSelectionModel got that clearSelections() and it works for normal RowSelectionModel (without header-stuff). And CheckboxSelectionModel has no own clearSelections(). But I'm not sure about that.
Sure, but if CheckboxSelectionModel extends RowSelectionModel it inherits all functions. If CheckBoxSelectionModel doesn't have an own clearSelections, the function of RowSelectionModel is used.
I put this
var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');
if (this.getCount() < this.grid.getStore().getCount()) {
hd.removeClass('x-grid3-hd-checker-on');
} else {
hd.addClass('x-grid3-hd-checker-on');
}
into the 'selectionchange'-event of the selection model
Hi,
I am using a new xg.CheckboxSelectionModel({singleSelect:true})
But, even though it allows only single row to be selected at any given time, the checkbox column header still contains the 'check all' checkbox ! which is very confusing.
Is there a way to not display this 'check all' header ? (for single select option/otherwise)
But have U seen what clearselections() does?
clearSelections : function(fast){
if(this.locked) return;
if(fast !== true){
var ds = this.grid.store;
var s = this.selections;
s.each(function(r){
this.deselectRow(ds.indexOfId(r.id));
}, this);
s.clear();
}else{
this.selections.clear();
}
this.last = false;
},
RowSelectionModel knows nothing about a header-field to set. Because its CheckboxSelectionModel specific.
Ok, now I understand. :)
But what I want is to to set the header unchecked initially, after the store has been loaded/refreshed. (If I checked the header before loading, it stays in the checked-state)
I thought I can add a load-listener (for the store) and set the header unchecked.
Is that possible?
I'm sorry. I don't understand what this should do. :(
That's what I tried. I called clearSelections(), but result is: only the rows are de-selected, the header is still checked.
Nortel Unveils Vision, Strategy for Israeli High-Performance Net
Busy Friday Leads to Strong Close for Net Stocks |