1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    17
    Vote Rating
    0
    Dirk1 is on a distinguished road

      0  

    Default Recalculate column width for editorgrid using forcefit

    Recalculate column width for editorgrid using forcefit


    Hi all,

    I have an editorgrid where I dynamically add some columns (I used this thread as tutorial: http://www.sencha.com/forum/showthre...ds-and-columns).

    For my editorgrid I use forecfit as param for the GridView.

    After adding the columns I would need to recalculate the width of the columns. Using the getView().refresh() or the grid.reconfigure(this.store, this.getColumnModel()) methods does not work.

    Do you have any ideas how I can solve my problem?

    Thanks and best wishes,

    Dirk

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default Try doLayout()

    Try doLayout()


    Hi Dirk1,

    Are you tried with grid.getView().refresh(true) passing true parameter ? Also you can try this one -
    Code:
    yourGrid.doLayout();
    See - http://docs.sencha.com/ext-js/3-4/#!...method-refresh
    http://docs.sencha.com/ext-js/3-4/#!...ethod-doLayout
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,935
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I would suggest using flex for your columns instead of using the outdated forcefit option.

    Scott.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    17
    Vote Rating
    0
    Dirk1 is on a distinguished road

      0  

    Default


    Hi sword-it and scottmartin,

    thanks for your fast response!

    @sword-it: This does not work, what a pitty.

    @scottmartin: Is there an example? I cannot find this attribute in the Ext.grid.GridColumn docs but I found it via google in some forum topics where they seem to use flex: 1 for flexible and flex: 0 for fix column widths?! But this does not work in my case, too.
    If I comment forcefit: true and set all columns to flex: 1, than the columns in the grid at all do not have the width of the view.

    Code:
                
    columns: [
               {                header: 'Header 1',
                    sortable: true,
                    css: "text-align : left;",
                    tooltip: 'Header 1 Tooltip',
                    dataIndex: 'INDEX_1',
                    flex: 1
                }
    ...
    ]
    Thanks and best wishes,

    Dirk

Thread Participants: 2