We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Get grid column order programatically

I have a grid that allows drag and drop reordering of the columns. I'd like to get the new order of columns so I can save and the next time the grid is displayed I can order the columns the same way. In addition, how do I know when the user has re-ordered columns? Is there an event I can hook into?

Thanks!

2 Replies

PS Paul Skelton September 27, 2019 04:39 PM UTC

I answered my own question...

 <GridEvents OnActionComplete="ActionCompletedHandler" TValue="DocShim"></GridEvents>


    public async void ActionCompletedHandler(ActionEventArgs<DocShim> args)
    {
        if (args.RequestType == Syncfusion.EJ2.Blazor.Grids.Action.Reorder)
        {
            // This will contain the new column order
            var cols = await grid.GetColumns();
        }
    }



VN Vignesh Natarajan Syncfusion Team September 30, 2019 05:41 AM UTC

Hi Paul,  

Thanks for contacting Syncfusion support.  

Query: “ In addition, how do I know when the user has re-ordered columns? Is there an event I can hook into? && I answered my own question... 
 
We are glad to hear that you have resolved the query on your own. Yes you can use OnActionComplete event and GetColumns() method to achieve your requirement. This (OnActionComplete) event will be triggered whenever certain action like paging, reorder, filtering, sorting, etc. get completed. 

Refer our UG documentation for the list of events support in EjsGrid along with API reference.  



Please get back to us if you have further queries.   

Regards, 
Vignesh Natarajan.  


Loader.
Live Chat Icon For mobile
Up arrow icon