View Full Version : How to make Statemanager save width of GridPanel

16 Jun 2013, 5:24 PM
Hi all,

I have a GridPanel with some columns, using a statemanager backed by database provider. When using a border layout, I'm trying to save the column widths (always works) and the width of the GridPanel. Sometimes I can see the width in the data (last property) and other times the width is not there. So the end result is sometimes the width is saved and other times it is not. It seems related to the width of the columns of the GridPanel in the main window (not the boder layout panel).
Can anyone tell me what determines if the overall GridPanel width is saved or not? Can't seem to find anything that gives a hint.

var cmpSlidout = new Ext.grid.GridPanel({
title: 'Content',
region: 'east',
collapsible: true,
split: true,
layout: 'fit',
anchor: '100% 50%',
width: 500,
minSize: 100,
maxSize: 800,
sortable: true,
stateId: slideoutStateId,
stateful: true,
stateEvents: ['columnmove', 'columnresize', 'sortchange', 'resize', 'show', 'hide'],
id: 'id-admin-slideout-grid',
ds: dsList,
loadMask: true,
emptyText: 'No available items.',
viewConfig: {
autoFill: true,
forceFit: true,
sm: new Ext.grid.RowSelectionModel({
singleSelect: false
cm: new Ext.grid.ColumnModel({
defaults: {
sortable: true
columns: [
{ header: 'Centre', dataIndex: 'Centre' },
{ header: 'Test', dataIndex: 'Test', width: 60 },
{ header: 'G', dataIndex: 'Gender', width: 30 },
{ header: 'Status', dataIndex: 'Status', width: 60, renderer: bedStatusRenderer },
{ header: 'Allocated', dataIndex: 'Allocated', width: 70 }
listeners: {
afterRender: function() {
var selectedCentre = "SRS";
dsList.reload({ params: { centre: selectedCentre }});
sm.Add(this, this.stateId);
resize: function() {
var state = this.getState();
Ext.state.Manager.set(this.stateId, state);