how to reorder the column using moveColumn() in javascript

Hi All,

I am using professional license of DHTMLX 3.0 and included “dhtmlxGrid3.0/codebase/ext/dhtmlxgrid_mcol.js” to re-order the column.

My application has two parts, admin and other user.
The column re-order is depends on admin setting.

i am trying use “moveColumn(0,2);” in “onXLE” method.
it is working fine but when the grid render the data after 100th data [lazyGrid.enableSmartRendering(true, 100);].
the “onXLE” method calls once again and the column moves to initial position.

I think this is not a good approach.

So please suggest me where i will call “moveColumn” method.

function initializeLazyGrid(){
lazyGrid = new dhtmlXGridObject(…);
lazyGrid.setImagePath(…);
lazyGrid.setColAlign(…);
lazyGrid.enableResizing(…);
lazyGrid.setColSorting(…);
lazyGrid.setSkin(…);
lazyGrid.init();
lazyGrid.enableEditEvents(true, false, false);
lazyGrid.enableSmartRendering(true, 100);
lazyGrid.enableMultiselect(true);
lazyGrid.attachEvent(“onXLE”, function(){
lazyGrid.moveColumn(0,2); // MOVE 0TH COLUMN TO 2ND
lazyGrid.setColWidth(3,“0”); //HIDE 3RD COLUMN
});
}

Thanks & Regards,
Abhi

You may try to check the label of the column before moving the column.
For example:
if(mygrid.getColLabel(0)==“label”){
mygrid.moveColumn(0,2);
}