-
6 Jan 2011 7:17 AM #1
Card Layout initially rendering grid small on setActiveItem...
Card Layout initially rendering grid small on setActiveItem...
Howdy gang,
I have a card layout filled with several panels (each is a parent of its own because it contains a search region and at least one grid panel) like this one:
When I setActiveItem on the grid panel's parent, it initially renders the grid as small as it can (essentially either using the height: and width: specified, or if none specified, according to its minimum size) and then immediately grows it to fit the entire parent card. Next time I setActiveItem on that grid, it is already fit.Code:var applicationsGrid = new Ext.grid.GridPanel({ title: 'applications', id:'applicationsGrid', store: applicationsStore, columns:applicationsColumns, margins: '0', region:'center', frame: false, dautoSize:true, disableSelection:true, trackMouseOver: false, stripeRows:true, viewConfig: { forceFit:false }, listeners: { cellclick: function(grid, rowIndex, colIndex) { alert( 'applications' ); } }, tbar:[ { xtype: 'tbfill' },{ text: 'Add applications', handler : function(){ addUpdateapplications(); } }], bbar: [ new Ext.PagingToolbar({ pageSize: 25, store: applicationsStore, displayInfo: true, displayMsg: 'Displaying topics {0} - {1} of {2}' }) ] });
Anyone have insight?
I tried:
Neither worked.Code:Ext.getCmp('content-panel').doLayout( false, true ); Ext.getCmp('content-panel').syncSize();
UPDATE:
calling setActiveItem on each panel consecutively and then the home panel last is a workaround, but it's not a solution.
Note: I'm assuming this is a simply oversight on my part (thinking that because I don't see anyone else saying this), that's why no test is included. If no answer, I'll spend the 10 minutes to make one.Don't measure excellence against others, but rather against the best implementation of yourself.
-
6 Jan 2011 2:56 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
My knee-jerk reaction is to reformat your code, as it is really hard to read in its current state.
Code:var applicationsGrid = new Ext.grid.GridPanel({ title: 'applications', id: 'applicationsGrid', store: applicationsStore, columns: applicationsColumns, margins: '0', region: 'center', frame: false, dautoSize: true, disableSelection: true, trackMouseOver: false, stripeRows: true, viewConfig: { forceFit: false }, listeners: { cellclick: function (grid, rowIndex, colIndex) { alert('applications'); } }, tbar: [{ xtype: 'tbfill' }, { text: 'Add applications', handler: function () { addUpdateapplications(); } }], bbar: [new Ext.PagingToolbar({ pageSize: 25, store: applicationsStore, displayInfo: true, displayMsg: 'Displaying topics {0} - {1} of {2}' })] });
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
6 Jan 2011 2:56 PM #3Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Your bbar should be
(removing the brackets)Code:bbar: new Ext.PagingToolbar({ pageSize: 25, store: applicationsStore, displayInfo: true, displayMsg: 'Displaying topics {0} - {1} of {2}' })
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
6 Jan 2011 2:58 PM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Setting "region" on a component that is not taking part of a border layout is useless.
The following is not a valid configuration option!Code:region: 'center',
Code:dautoSize: true,

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
6 Jan 2011 3:00 PM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Looking at your UI, you seem to be over-nesting. With the little bit of code you've provided, I can't provide a solution. My only suggestion is to have the grid panel as a direct child of the container implementing the card layout.

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
Similar Threads
-
Card Layout: setCard vs. setActiveItem
By DaveC426913 in forum Sencha Touch 1.x: DiscussionReplies: 7Last Post: 3 Sep 2011, 3:49 PM -
setActiveItem in card layout + effect
By nick saint in forum Ext 3.x: Help & DiscussionReplies: 5Last Post: 21 Jul 2010, 8:15 PM -
[CLOSED] [3.2.1] my card layout's setActiveItem function is null?
By darthwes in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 21 May 2010, 12:36 PM -
setActiveitem in card layout issue
By iBeb in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 7 May 2009, 5:29 AM -
Card layout and setActiveItem
By Gunmen in forum Ext 2.x: Help & DiscussionReplies: 7Last Post: 30 Apr 2008, 6:28 AM



Reply With Quote