Grid query.

Hey, to avoid opening a different topic, I have a problem preventing automatic SfGrid sort.


I created a CustomAdaptor component where I have overriden all the methods to just return DataSource as is, but regardless, my Grid gets sorted automatically when clicking on the column.


How do I prevent automatic sorting but leave AllowSorting as true?


Amar.


1 Reply

SP Sarveswaran Palani Syncfusion Team September 27, 2022 05:00 PM UTC

Hi Amar,


Thanks for contacting Syncfusion support.


We have analyzed your query and would like to inform you that; sorting will happens when you clicking the column header on enabling AllowSorting as true in the grid. It won’t work when sorting is not handled in ReadAsync method of CustomAdaptor., but it displays arrow in the column header of the grid. This is the default behavior of the component. If you want prevent sorting by setting args.cancel as true in the ActionBegin Event. Kindly refer the shared code snippet for your reference.


public void ActionBegin(ActionEventArgs<Order> args)

    {

        if (args.RequestType == Syncfusion.Blazor.Grids.Action.Sorting)

        {

            args.Cancel = true;

        }

    }


Kindly get back to us if you have any further queries


Regards,

Sarveswaran PK


Loader.
Up arrow icon