Reputation: 96
EXT version 3.3.0
I have a grid panel with sortable columns. It works with 90% of the users. But with some users, the first column (which is an integer) renders as not sortable. Even when you click on the pop up menu above the column, the "Sort Ascending" and "Sort Descending" are greyed out. I cannot replicate this error, but I have seen it on other user workstations. Here are more details:
I don't have the source code on this network, o/w I would just paste it in.
Thanks!
Upvotes: 2
Views: 2108
Reputation: 2604
I remember I had similar issue some time ago, and the deal was that ExtJs grid restores it's state from cookies incorrectly. After some debugging I added the following patch:
Ext.override(Ext.grid.GridPanel, {
applyState: function (state) {
var cm = this.colModel,
cs = state.columns,
store = this.store,
s,
c,
colIndex;
if (cs) {
for (var i = 0, len = cs.length; i < len; i++) {
s = cs[i];
c = cm.getColumnById(s.id);
if (c) {
colIndex = cm.getIndexById(s.id);
cm.setState(colIndex, {
hidden: s.hidden,
width: s.width,
sortable: s.sortable,
fixed: cm.columns[colIndex].fixed
});
if (colIndex != i) {
cm.moveColumn(colIndex, i);
}
}
}
}
if (store) {
s = (state.sort instanceof Array) ? state.sort[0] : state.sort;
if (s) {
store[store.remoteSort && store.groupBy ? 'setDefaultSort' : 'sort'](s.field, s.direction);
}
s = state.group;
if (store.groupBy) {
if (s) {
store.groupBy(s);
}
else {
store.clearGrouping();
}
}
}
var o = Ext.apply({}, state);
delete o.columns;
delete o.sort;
Ext.grid.GridPanel.superclass.applyState.call(this, o);
}
});
The only extra thing it does it restore fixed property from the cookies as well.
Upvotes: 1