Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by gilles on Dec 29, 2009 07:18
open dhtmlx forum
Column moving

Hello,

I would like to know if there is a way to block certain columns to be moved when the enableColumnMove option is on.
Same with the enableHeaderMenu option, to prevent certain columns from being hidden.
Answer posted by dhxSupport on Dec 29, 2009 07:54
>>I would like to know if there is a way to block certain columns to be moved when the enableColumnMove option is on.
You can use onBeforeCMove event. Please find example here http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/16_rows_columns_manipulations/13_pro_grid_moveCol.html
>>Same with the enableHeaderMenu option, to prevent certain columns from being hidden.
It can be done only with code modification. In the file dhtmlxgrid_hmenu.js line 81 (inside dhtmlXGridObject.prototype._createHContext=function() function):

for (var i; i<this.hdr.rows[1].cells.length; i++){

                               var c=this.hdr.rows[1].cells[i];

                               if (c.firstChild && c.firstChild.tagName=="DIV") var val=c.firstChild.innerHTML;

                               else var val = c.innerHTML;

                              

                               if (val!="NECESSARY COLUMN LABEL") {

                              

                               a.push("<div class='dhx_header_cmenu_item'><input type='checkbox' column='"+true_ind+"' len='"+(c.colSpan||1)+"' checked='true' />"+val+"</div>");

                               true_ind+=(c.colSpan||1);

                                   }

                }