PDA

View Full Version : Last column to auto-adjust



KimH
2 Mar 2007, 12:53 AM
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?

jack.slocum
2 Mar 2007, 8:35 AM
It will involve some calculations, to do it efficiently it should be handled internally. I will look into it.

lorenzo
2 Mar 2007, 10:29 AM
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.

jratcliff
2 Mar 2007, 11:16 AM
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.

KimH
2 Mar 2007, 12:43 PM
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!

JeffHowden
2 Mar 2007, 12:48 PM
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.

Wolfgang
3 Mar 2007, 6:06 PM
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.

jack.slocum
4 Mar 2007, 2:54 AM
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 ;)).

lorenzo
4 Mar 2007, 2:59 AM
Thank you Jack... You are always the best.

KimH
4 Mar 2007, 11:47 AM
Ok, I added it.
Thank you, Jack!


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!


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.

jratcliff
4 Mar 2007, 2:19 PM
Awesome! You are making it easier and easier for the grid to look and function like a Lotus Notes Client view from the web.

Thanks again!

jack.slocum
4 Mar 2007, 7:06 PM
No problem. Let me know if you guys have any problems with it (on next rev).