Feb 14, 2015, 8:39 PM
[CLOSED] CheckboxSelectionModel override updateHeaderState
I have a GridPanel using the CheckBoxSelectionModel. I have read several threads and have been able to define CSS to replace the checkbox with icons if the row should not be selected via the GridView GetRowClass. This is based on a field in the store named AccessLevel. If it is a 0 I assign wsFileLink_na css (which shows the BulletCross icon) and if it is a 1 I assign wsFileLink_Link (which shows the Link icon). If the value is 2 no css is assigned and thus the checkbox is available to be checked. I defined additional CSS to make sure everything was aligned properly.
The last hurdle is when you select the Header checkbox. It selects all the rows that have checkboxes, but it doesn't stay checked because not everything in the store is checked (basically the disabled rows).
The following thread discussed it directly, but Daniil wasn't able to provide an example. I have other GridPanels using the CheckBoxSelectionModel so I need to be careful with any override so as not to break the other GridPanel stores. Any additional thoughts 2 months later?
Issue with grid panel header check box in CheckboxSelectionModel
Below is the private method updateHeaderState for Ext.selection.CheckboxModel
The last hurdle is when you select the Header checkbox. It selects all the rows that have checkboxes, but it doesn't stay checked because not everything in the store is checked (basically the disabled rows).
The following thread discussed it directly, but Daniil wasn't able to provide an example. I have other GridPanels using the CheckBoxSelectionModel so I need to be careful with any override so as not to break the other GridPanel stores. Any additional thoughts 2 months later?
Issue with grid panel header check box in CheckboxSelectionModel
Below is the private method updateHeaderState for Ext.selection.CheckboxModel
updateHeaderState: function() {
var me = this,
store = me.store,
storeCount = store.getCount(),
views = me.views,
hdSelectStatus = false,
selectedCount = 0,
selected, len, i;
if (!store.buffered && storeCount > 0) {
selected = me.selected;
hdSelectStatus = true;
for (i = 0, len = selected.getCount(); i < len; ++i) {
if (!me.storeHasSelected(selected.getAt(i))) {
break;
}
++selectedCount;
}
hdSelectStatus = storeCount === selectedCount;
}
if (views && views.length) {
me.toggleUiHeader(hdSelectStatus);
}
}
Last edited by fabricio.murta; Feb 16, 2015 at 7:59 PM.
Reason: [CLOSED]