Page 1 of 1

Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 10:42 am
by vladoportos
Hello all,

This might be realy stupid question as I looked through this forum and nobody asked it before :) so either I'm doing something wrong or everybody figure it out...

When I have datagrid with, lets say, 4 columns there is always 5th empty one... why is that ? Or better yet how I can get rid of it ?

See attached picture

Thanks.
Vladimir

Re: Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 11:23 am
by Klaus
Hi Valdimir,

there is no 5th column, it just looks like :D

If the sum of the length of all your columns < the witdh of the datagrid,
then you see "empty space" in the rest of the datagrid.

The only way to get rid of this is to resize you columns until they fill
the complete datagrid.

Imagine a field which has less text in it than its height.
Nooone will wonder why there is so much space at the bottom!
Same with the datagrid :)


Best

Klaus

Re: Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 12:52 pm
by snm
You can drag the last column header divider to the right edge of DataGrid if you have dColumnsResizable property set to true.

Marek

Re: Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 2:25 pm
by vladoportos
Thanks both, I thought it was something simple / strange :)

I will look in help how to resize the last divider to the right

Vlad

Re: Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 2:47 pm
by Klaus
Hi Valdimir,

1. in the inspector for your datagrid select the column "Meno" and check "Drag to resize"
2. Resize your last column until it fits (and/or all other columns, too).
3. Uncheck "Drag to resize" for that column again
4. save your stack and be happy :D


Best

Klaus

Re: Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 2:57 pm
by snm
But it works only to the next stack resize. I thing that better and forever will be to set the width of last column to the width of DataGrid minus the sun of widths of rest columns and put such script step in proper handlers of the column behavior script. It should be also possible to put it in "on resizeStack" handler located in stack script, but I'm not sure.

Marek

Re: Removing the last empty column in datagrid

Posted: Thu Jul 05, 2012 5:59 pm
by vladoportos
ok so code for it is like this:

Code: Select all

   -- put width of columns in variables ( last one is Meno ( name ) that we will set 
   put the dgColumnWidth["Typ"] of group "dGrid" into sTyp
   put the dgColumnWidth["Vyrobca"] of group "dGrid" into sVyrobca
   put the dgColumnWidth["Kategoria"] of group "dGrid" into sKategoria
   put the Width of group "dGrid" into full_size  --get full size
   
   -- next put the new lengt of last column based on full size - 15px ( thats the size of scroller so the bottom scroller dont apear )
   -- and minus the size of the rest columns before the last
   put (full_size - 15 ) - (sTyp + sVyrobca + sKategoria ) into sMeno
   
   -- set the width of the last column
   set the dgColumnWidth["Meno"] of group "dGrid" to sMeno
The question is into which handler put this code ? I need it to happen when somebody resize the column manually, or the whole stack is resized.

Re: Removing the last empty column in datagrid

Posted: Tue Jul 10, 2012 8:33 am
by vladoportos
Ok if somebody needs it than put it into

Code: Select all

on resizeControl
it will work accurately.

if I put it into

Code: Select all

on resizeStack
it would not update correctly with fast move ( if you drag the window too fast ) I rely don't know why is that.