Sorting under the hood

Hello

The case is with sorting, grid component configured with allowSorting prop coz of ability to sort data by backend, but if passing sorted array of data into dataSource property - grid will sort data under the hood coz of state of column.

Is there any way to disable sorting under the hood but with sorting indicators on columns and ability to trigger sort action by clicking on columns?


3 Replies 1 reply marked as answer

AG Ajith Govarthan Syncfusion Team January 20, 2021 12:26 PM UTC

Hi Olga, 
 
Thanks for contacting Syncfusion support. 
 
Query: Is there any way to disable sorting under the hood but with sorting indicators on columns and ability to trigger sort action by clicking on columns? 
 
Based on your query we suspect that you want to disable our EJ2 grid’s default sorting operation and want to perform your own the sorting operation at the server side with the grid dataSource. So, before we proceed to your query please confirm that you also expecting the same behavior at your end. If not please share the below details to find the validate further on your query. 
 
  1. Share the complete grid code example.
 
  1. Share the screenshot or video demonstration of your requirement.
 
  1. Please let us know if you have used remote data or local data in your grid application.
 
  1. Share the Syncfusion package version.
 
Regards, 
Ajith G. 



OL Olga January 21, 2021 02:23 PM UTC

  const dataSourceConfig = useMemo(() => ({
      json: localData,
      enableSorting: false
}),
[localData]
);

<GridComponent
toolbarClick={onToolbarActionClick}
recordClick={onRowClick}
allowSorting
dataSource={dataSourceConfig}
sortSettings={sortSettings}
actionBegin={handleActionBegin}
columns={normalizedColumns}
toolbar={toolbar}
showColumnChooser
allowResizing
allowReordering
ref={setRef}
>
<Inject services={SERVICES} />
</GridComponent>

As you can see on the screenshot we need to be able to sort columns, but sorting will be processed on the server side, so we are using remote data.
Currently used version is 18.2.59 (@syncfusion/ej2-react-grids)



AG Ajith Govarthan Syncfusion Team January 22, 2021 01:24 PM UTC

Hi Olga,  
  
Thanks for update. 

Query: Is there any way to disable sorting under the hood but with sorting indicators on columns and ability to trigger sort action by clicking on columns? 
 
Based on the attached code example we suspect that you need to perform the sorting at the server side and also you have taken the grid dataSource from the Custom API. So, based on that we suggest you use the URL adaptor in your grid application using the URL adaptor you can perform the actions like sorting, filtering, searching at the server side. 

For your convenience we have attached the documentation so please refer the documentation for your reference. 

UG-Links: 



Please get back to us if you need further assistance. 

Regards, 
Ajith G.  


Marked as answer
Loader.
Up arrow icon