Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ashok on Jan 30, 2009 00:54
open dhtmlx forum
Grid header Resize problem

Hi Team,

I need answer for the following

1. How can I get the Current Column Index when i try to drag for resize

2. I need to change the cells width for only the current Column index and the next column index only .. not to change all the others cells width in the grid.

3. If the current column index is a last column index then i need to adjust the previous column width only.


please help me to provide the solutions for this questions to achieve my target.

Thanks & Regards,
Ashok
Answer posted by Support on Jan 30, 2009 01:26
>>1. How can I get the Current Column Index when i try to drag for resize
mygrid.attachEvent("onResize",function(index,width){
    //called for each column resize iteration 
    // index - index of resized column
});

Also , there is an onResizeEnd event, which doesn't provide any extra info, but allows to catch the moment when resize finished.
Answer posted by Support on Jan 30, 2009 01:25
>>I need to change the cells width for only the current Column index and the next column index only
You can define which columns can be resized and which is not by 
    grid.enableResizing(list) //list - comma separated list of true|false values for related columns
Answer posted by Ashok on Jan 30, 2009 01:54
>>You can define which columns can be resized and which is not by 
    grid.enableResizing(list) //list - comma separated list of true|false values for related columns

in the runtime only i need this.. at that time i cant give every time the list to which is false and which is true...

my requirement is for example

my grid is having 10 columns and all the columns are allowed to resized.

every column width is  defined in % way, that is 10 each... so total 100%
 
when i try to resize the 3rd column from 10 % to 15 % then  the 3rd column column width is 15% and 4th column width is 5%.. like that. but no other  index cell width should not changed.

Regards,
Ashok
Answer posted by Support on Feb 03, 2009 03:34
Grid has not built in support for such use-case. You can do the next
a) store initial sizes of columns ( grid.getColWidth(index) )
b) use onResize event to save index of resized column 
c) use onResizeEnd event to catch the moment when resize finished
   now you know the index of column , its original size and its new size, so you can specify size for sibling column through grid.setColWidth