Hi,
I want to SELECT a PARTICULAR column just like MS Excel.
and
Suppose I select column D and select “insert column” then I want to insert column before that SELECTED column.
How to do it ?
There is no such functionality as column selection in dhtmlxgrid, you can select the row ( and get ID of selecter row ) or select cell in grid ( and get ID of row and index of column where cell was selected )
>> then I want to insert column before that SELECTED column
var ind = SOME_INDEX;
grid.insertColumn(ind,“new”,“ro”,“100”); //will insert new column before column with SOME_INDEX
I have tried what was suggested, and although column is added correctly, after reentering the grid with a mouse, I get a following js error: “Microsoft JScript runtime error: ‘cell._attrs.title’ is null or not an object” the break is in dhtmlxgrid.js on row 569: "if (!ced.cell._attrs[‘title’])"
I am not sure if the reentering the grid causes this to fail, or if there is something else going on…
On a related note, there is a sort event built in the grid, which means that there is got to be some was of selecting a particular index or header… I wonder if right click even for a header would be a relatively easy task to implement…
Thank you
after reentering the grid with a mouse
Problem confirmed and fixed ( the problem may occur in case of specific combination of grid’s modes ) - if you need fix ASAP - please contact us directly at support@dhtmlx.com
>> which means that there is got to be some was of selecting a particular index or header.
The sorting automatically fire when mouse clicked on any cell in header, this is controlled by column sorting type ( grid.setColSorting )
>>I wonder if right click even for a header would be a relatively easy task to implement
The grid has next event onHeaderClick - which occur when any cell in header clicked, second parameter of event is the event object of browser, so it is possible to separate right clicks
grid.attachEvent(“onHeaderClick”,function(index,e){
if (e.button==2) alert("rigth click at column "+index);
return true;
})