1. #1
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    403
    Vote Rating
    0
    KimH is on a distinguished road

      0  

    Default Last column to auto-adjust

    Last column to auto-adjust


    I can't see that this is currently possible, so please enlighten me if you know the answer:

    I have a grid in a GridPanel where I wan't the last column to always fill up the rest (the 'whitespace' to the right of the grid) if the total width of the columns is not as wide as the GridPanel itself.

    How to do this... if it can be done?

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    It will involve some calculations, to do it efficiently it should be handled internally. I will look into it.

  3. #3
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    13
    Vote Rating
    0
    lorenzo is on a distinguished road

      0  

    Default


    Quote Originally Posted by jacksloc
    It will involve some calculations, to do it efficiently it should be handled internally. I will look into it.
    Hey Jack... I would like to have such a function too.

    Thanks again for your job.

  4. #4
    Sencha - Services Team
    Join Date
    Mar 2007
    Location
    Foristell, MO
    Posts
    1,109
    Vote Rating
    3
    jratcliff is on a distinguished road

      0  

    Default


    For the domino developers out there, this would also be nice since Domino has a setting for 'views' (that we are displaying in the grid) to 'extend last column to window width'. I personally, would prefer if there were a way to pick *any* column as the one to grow/shrink automatically. Or (and maybe you already have this), you could have a minWidth and maxWidth and the grid will auto resize columns based off of these as well. Maybe the grid could even have a setting for minHeight and maxHeight for rows.

  5. #5
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    403
    Vote Rating
    0
    KimH is on a distinguished road

      0  

    Default


    Quote Originally Posted by jacksloc
    It will involve some calculations, to do it efficiently it should be handled internally. I will look into it.
    Thanks Jack... it would be really nice!

  6. #6
    Sencha - Community Support Team JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
    JeffHowden is on a distinguished road

      0  

    Default


    I'd have to second that the "extend last column to window width" would be much better if it defaulted to the last column, but could be configurable.

  7. #7
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default


    Quote Originally Posted by JeffHowden
    I'd have to second that the "extend last column to window width" would be much better if it defaulted to the last column, but could be configurable.
    I would 2nd this, too.

  8. #8
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Ok, I added it.

    autoExpandColumn config option, that will need to be the id of a column in your column model. It doesn't default to the last column, you will need to specify a valid id. We just eliminated column order dependencies and I don't want to introduce a new one.

    Some limitations (aka features):

    It only grows, and doesn't shrink. Shrinking could be put in, but it will result in more calculation (not code wise, performance wise). I wouldn't recommend it, but I could add it.

    A column auto expand (or shrink) has the overhead of a double layout but is still 5-10x faster than an autoSizeColumns call.

    Once the user has resized any column, auto expand is turned off. If not, all kinds of undesirable behavior happens (e.g. user resizes any column smaller and it auto pops back to where it was ).

  9. #9
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    13
    Vote Rating
    0
    lorenzo is on a distinguished road

      0  

    Default


    Thank you Jack... You are always the best.

  10. #10
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    403
    Vote Rating
    0
    KimH is on a distinguished road

      0  

    Default


    Quote Originally Posted by jacksloc
    Ok, I added it.
    Thank you, Jack!

    Quote Originally Posted by jacksloc
    autoExpandColumn config option, that will need to be the id of a column in your column model. It doesn't default to the last column, you will need to specify a valid id. We just eliminated column order dependencies and I don't want to introduce a new one.
    Sounds reasonable!

    Quote Originally Posted by jacksloc
    Some limitations (aka features):

    It only grows, and doesn't shrink. Shrinking could be put in, but it will result in more calculation (not code wise, performance wise). I wouldn't recommend it, but I could add it.

    A column auto expand (or shrink) has the overhead of a double layout but is still 5-10x faster than an autoSizeColumns call.

    Once the user has resized any column, auto expand is turned off. If not, all kinds of undesirable behavior happens (e.g. user resizes any column smaller and it auto pops back to where it was ).
    Okay. I will try to see if we can use this... well... of course we can... it's just that I think of the last columns in my layout that is currently hidden... if the users unhide these then I will try to find a way to make the last newly unhidden column the auto-resize-to-the-rest column instead.

Similar Threads

  1. Grid - Auto-resize column-width after load
    By KimH in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 2 Mar 2007, 4:49 AM
  2. Adjust the height of a ContentPanel in code ?
    By klubas in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 13 Feb 2007, 5:08 AM
  3. Multiple Grids on a Page, Column Adjust Problem?
    By rooster in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 8 Jan 2007, 1:42 PM
  4. YUI:Auto Complete auto hide
    By techno_adi in forum Ext 1.x: Help & Discussion
    Replies: 9
    Last Post: 24 Dec 2006, 9:44 PM

Thread Participants: 5