-
18 May 2010 7:00 AM #11
Restore default configuration.
Restore default configuration.
if you want the option to restore default settings, I use this code (a function that returns the default column model so we aren't passing in a reference that would be changed by the grid):
function defaultColumnModel(){
return [
{
id: 'request_row',
header: 'Request ID',
dataIndex: 'request_id',
renderer: renderRequest,
align: 'right',
width: 90,
sortable: true,
columnIndex: 0,
hidden: false
},...
];
}
Then I add the button to the bottom toolbar to reload the old configuration:
grid.getBottomToolbar().add([
'->'
, {
text: 'Reset Column Configuration',
handler: function () {
grid.filters.clearFilters();
grid.getColumnModel().setConfig(defaultColumnModel(), false);
}
}
, {
text: 'Clear Filter Data',
handler: function () {
grid.filters.clearFilters();
}
}
]);
-
8 Jul 2010 1:38 AM #12
Please tell me how did you save the state of hidden columns in cookie?
-
8 Jul 2010 2:15 AM #13Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
1. Register a cookie provider:
2. Disable state management for all components by default:Code:Ext.state.Manager.register(new Ext.state.CookieProvider());
3. Enable state management for the grid:Code:Ext.Component.prototype.stateful = false;
4. Give all your columns an id (otherwise they will be stored by number, which would break if you ever add columns).Code:stateId: 'mygrid', stateful: true
-
8 Jul 2010 4:09 AM #14
While using grid.getBottomToolbar().add ..shows error in firebug console
function not defined....
-
8 Jul 2010 4:14 AM #15
-
8 Jul 2010 4:17 AM #16
-
8 Jul 2010 4:21 AM #17Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Wow, that's old. Toolbars were completely redesigned in Ext 3, so you need different code for Ext 2.1 (you'll need to check the Ext 2.1 Toolbar API docs because I don't even remember how I did it back then).
-
5 Nov 2010 2:26 PM #18
-
5 Nov 2010 11:25 PM #19Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
-
9 Nov 2010 1:52 PM #20


Reply With Quote