Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ramakrishna on Aug 01, 2008 08:28
open dhtmlx forum
DHTMLX Grid : Insert, Delete column dynamically

Hi,
I want to add the column dynamically such that

: The newly inserted column should adjust its width according to the pre-defined(100%) div width.
: Also I have customize the style of the grid using setColumnColor().

Please help.

This is the function I have written :

libTableGrid.insertColumn(libTableGrid.getColumnsNum()+1,window.prompt('Column Header Name'),'ed','15','str','left','center',false,'white');
__________________________________________________________________________________

I want to delete the SELECTED column (When I click in Header) dynamically. How to do it ?
__________________________________________________________________________________

I want to sort the SELECTED row. How to do it ?
Answer posted by Support on Aug 04, 2008 03:07

>>: The newly inserted column should adjust its width according to the pre-defined(100%) div width.
Width of added column must be defined in pixels, so you can use 
libTableGrid.insertColumn(libTableGrid.getColumnsNum()+1,window.prompt('Column Header Name'),'ed',mygrid.entBox.offsetWidth*0.15,'str','left','center',false,'white');

>>I want to sort the SELECTED row. How to do it ?

Sorting columns not supported. Component can sort only rows. 

>>I want to delete the SELECTED column
There is no such functionality as column selection, but you can get index of currently selected column in data part of grid as
          grid.getSelectedCellIndex()
and use related value in any command. 
Technically, click in grid's header can be catched by using 
           onHeaderClick
event.