Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ram on Jun 23, 2009 07:43
open dhtmlx forum
DHTMLX Grid

How to set fixed size to header in grid while resizing?i.e the header text should not go more than 2 lines while shrinking..
Answer posted by dhxSupport on Jun 23, 2009 09:19
There is no inbuild functionality to  set maximum width for the certain column. But it can be customized using enableResizing() and "onResize" event. enableResizing(list) method enables/disables resizing for specified colums, list - list of comma separated true/false values.
You can catch "onResize" event and check if it necessary to block column resizing. This event occurs on each resize iteration. onResize event passes the following parameters: 
cInd - index of the cell;
cWidth - width of the cell;
obj - grid object.
  mygrid.attachEvent("onResize", function(cInd,cWidth,obj){});

You can find out actual column's width using getColWidth(ind) where ind - column index.

Also you can set max width for the grid container in the auto width mode:
//enable auto width mode, set maximal and minimal allowed width
  mygrid.enableAutoWidth(true,600,100);