hi
when the user clicks on a cell i dont want the row to be highlighted but i want all the cells in that column to be highlighted. how can i do this please, i have tried to look through your documentation and tried several methods but could not work it out
thanks
richard
Unfortunately dhtmlxGrid hasn’t such functionality.
do you have any work arounds where i could achieve this?
Technically you can catch header click event and set custom style for all cells in the column
grid.attachEvent(“onHeaderClick”,function(index,e){
grid.forEachRow(function(id){
grid.setCellTextStyle(id, index, “background-color:red”);
})
})
this works great, thanks… except the previously selected column stays selected when we click a new column… what would be the best way to turn this off - we could do this manually by setting all cells in the previously selected column to white but the grid uses the odd row blue and white colours, therefore we want to reset it back to its original colours. is there a way to do this please?
in addition to the other question asked above, how can we attach this event to the downclick of the mouse instead the upclick as it is now?
is there a way to do this please?
You can process all rows in the same manner , but use
grid.setCellTextStyle(id, index, “”);
It will clear all properties assigned through style, but even|uneven colors defined through css classes, so they will not be affected by such code.
>>how can we attach this event to the downclick of the mouse instead the upclick as it is now
Can be done only be code modification
dhtmlxgrid.js , line 3128
this.hdr.onclick=this._onHeaderClick;
can be changed as
this.hdr.onmousedown=this._onHeaderClick;
thanks, your solutions work really well.
however, is there a way i can place the “this.hdr.onmousedown=this._onHeaderClick;” code in my template without modifying your dhtmlxgrid.js file. this is so that i wont have to keep modifying yor code each time you deliver a new update to that file
thanks
richard
i modifying just the grid i want it to work on by adding:
mygrid.hdr.onmousedown=mygrid._onHeaderClick;
thanks
i modifying just the grid i want it to work on by adding:
Yes, this is the correct way
mygrid.hdr.onclick=null; //clear old handler
mygrid.hdr.onmousedown=mygrid._onHeaderClick;
thanks