1. #1
    Sencha User
    Join Date
    Mar 2008
    Location
    Marietta, GA
    Posts
    93
    Vote Rating
    0
    jasondeegan is on a distinguished road

      0  

    Default 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:
    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}' }) ]
    });
    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.

    Anyone have insight?

    I tried:
    Code:
    Ext.getCmp('content-panel').doLayout( false, true );
    	Ext.getCmp('content-panel').syncSize();
    Neither worked.

    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.
    Attached Images
    Don't measure excellence against others, but rather against the best implementation of yourself.

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    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}'
        })]
    });

  3. #3
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Your bbar should be
    Code:
        bbar: new Ext.PagingToolbar({
            pageSize: 25,
            store: applicationsStore,
            displayInfo: true,
            displayMsg: 'Displaying topics {0} - {1} of {2}'
        })
    (removing the brackets)

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Setting "region" on a component that is not taking part of a border layout is useless.
    Code:
        region: 'center',
    The following is not a valid configuration option!
    Code:
        dautoSize: true,

  5. #5
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    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.

Similar Threads

  1. Card Layout: setCard vs. setActiveItem
    By DaveC426913 in forum Sencha Touch 1.x: Discussion
    Replies: 7
    Last Post: 3 Sep 2011, 3:49 PM
  2. setActiveItem in card layout + effect
    By nick saint in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 21 Jul 2010, 8:15 PM
  3. [CLOSED] [3.2.1] my card layout's setActiveItem function is null?
    By darthwes in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 21 May 2010, 12:36 PM
  4. setActiveitem in card layout issue
    By iBeb in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 7 May 2009, 5:29 AM
  5. Card layout and setActiveItem
    By Gunmen in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 30 Apr 2008, 6:28 AM

Thread Participants: 1

Tags for this Thread