-
14 Sep 2010 10:25 AM #1
[OPEN-1268] GridPanel.applyState does not handle column total width correctly
[OPEN-1268] GridPanel.applyState does not handle column total width correctly
Ext version tested:
- Ext 3.2.0
Adapter used:- ext
[ ]yui
[ ]jquery
[ ]prototype
css used:- only default ext-all.css
[ ]custom css (include details)
Browser versions tested against:- Chrome
- IE6
- FF3 (firebug 1.3.0.10 installed)
- Safari 4
Operating System:- Windows Server 2003
Description:- Calling applyState on a GridPanel should apply a new column model to the grid when it is present in the state argument
- Instead of calling setConfig on the ColumnModel the code is optimized to re-use existing columns
- When updating an existing column it accesses hidden and more importantly the width property directly rather than using the ColumnModel's setColumnWidth helper function OR setting the ColumnModel's totalWidth to null.
- You need to use the setColumnWidth function OR null totalWidth in order to get the totalWidth property recalculated.
- The problem being seen is the columns are correctly being set but the width is all wrong...changing states from 3 columns to 1 column results in 1 column visible but stretched to the total width of the previous 3 columns.
The result that was expected:- Applying a new state to a grid where the columns are different from existing columns should result in the grid re-building its column correctly with the correct column width being applied and visible to the user.
The result that occurs instead:- The right number of columns are visible but the width is wrong - the width being the same as the previous total width of the columns.
Debugging already done:- Stepped through the code, observed problem, applied fix below...observed correct behavior.
Possible fix:
Override the grid's applyState function to flush the totalWidth attribute...forcing it to be recalculated...
Ideally, the existing applyState function should be re-written to null out the totalWidth property...Code:applyState: function(state) { this.getColumnModel().totalWidth = null; pf.viewgrid.GridStatePanel.superclass.applyState.call(this, state); },
Code:applyState : function(state){ .... if (cs){ .... cm.totalWidth = null; } .... }
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[2.x][CLOSED] GridPanel applyState: Hidden doesn't hide column header
By durlabh in forum Ext 2.x: BugsReplies: 5Last Post: 7 Jun 2012, 12:46 AM -
Gridpanel column width
By alupuli in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 2 Jul 2010, 2:04 AM -
Setting a GridPanel width to the total width of the visible columns
By aendo in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 29 Nov 2007, 9:24 AM -
column width gridpanel - auto width??
By gurpal2000 in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 27 Nov 2007, 5:41 PM -
[2.0rc1] Column layout does not share out total width
By Animal in forum Ext 2.x: BugsReplies: 1Last Post: 23 Nov 2007, 3:43 PM


Reply With Quote