Get column order after reorder.

I am using this event for column reorder:
columnDrop: function (args) { 
                        console.log(args);
                    },
I need column id, which I can get with args.column.id (because I add this property to the columns when Grid is created), but I need and new order/place of the column or all columns with new order, but in args there is nothing for that.
How to get and column order with Syncfusion Grid ?

1 Reply

RS Renjith Singh Rajendran Syncfusion Team September 13, 2017 09:51 AM UTC

Hi Customer, 

Thanks for contacting Syncfusion support, 

We have analyzed your query. We have achieved your requirement by using the “actionComplete” event of Grid. Please refer the sample below 

$("#Grid").ejGrid({ 
             ... 
             ... 
             actionComplete: function (args) { 
                  if(args.requestType == "reorder") 
                  { 
                    for(i=0;i<args.model.columns.length;i++) 
                    { 
                       if(i + 1 != args.model.columns[i].id ) 
                       args.model.columns[i].id = i + 1 
                    } 
                  } 
             },  
             columns: [ 
                         { field: "OrderID",id:1, isPrimaryKey: true, headerText: "Order ID", textAlign: ej.TextAlign.Right, width: 90 }, 
                         ... 
                         ... 
                     ] 
            }); 
        }); 

We have also prepared a JSPlayground sample, please refer the sample below 

Please refer the documentation link below, 

Regards, 
Renjith Singh Rajendran. 


Loader.
Up arrow icon