Update Grid Column Order

Using suite5 Pro, I save the grid order, into a table, by using the following:

mygrid._c_order

I can pull the grid order from the table, and I want to set the Column Order during the “onXLE” event. I cannot find anything that will allow me to set the order. Can you assist. Please let me know if you need any additional information. I can’t use the cookies process.

Steve

Hello Steve.

Please, try to use this function to reorder the columns in your grid according to the predefined order saved with the myGrid._c_order:

    function setColOrder(){
      var z = colOrder; //your originally saved myGrid._c_order
      for (var i=0; i<z.length; i++)
        if ((!myGrid._c_order && z[i]!=i)||(myGrid._c_order && z[i]!=myGrid._c_order[i])){
          var t=z[i];
          if (myGrid._c_order)
            for (var j=0; j<myGrid._c_order.length; j++) {
              if (myGrid._c_order[j]==z[i]) {
                t=j; break;
                }
            }
          myGrid.moveColumn(t*1,i);
        }
    }

Kind regards,