Sample: dhtmlxGrid Move column dhtmlxGrid main page
X

Move column with drag-n-drop

 
    mygrid.enableColumnMove(true);
    //to prohibit moving some (or all) columns in some condition use event handler
    mygrid.attachEvent("onBeforeCMove",function(sInd,tInd){
        return confirm("Allow move column "+sInd+" to position "+tInd);//return true to allow, false - to prohibit
    });

Move column with script

Move column to
 
    mygrid.moveColumn(oldInd,newInd)
THIS PAGE CONTAINS SAMPLE FUNCTIONALITY OF PROFESSIONAL EDITION FOR DEMONSTRATION PURPOSE ONLY.
UNAUTHORIZED USE IS PROHIBITED. PLEASE CONTACT SALES@DHTMLX.COM TO OBTAIN A LEGAL COPY OF PROFESSIONAL EDITION.