Search code examples
devextreme

DevExpress - Convert "sort string"(json), "filter string" to sql


I use devextreme grid with a special data source https://js.devexpress.com/Demos/WidgetsGallery/Demo/DataGrid/CustomDataSource/React/Light/ parameter "sort", "filter" successfully passed to the backend

In my backend I catch the value:

* sort -> [{"selector": "Id", "desc": true}]

* filter -> ["RoleName", "contains", "test"]

How do i convert :

* sort -> ORDER BY Id DESC 

* filter -> RoleName LIKE '%test%'

notes : that is just a simple example in the real case it could be that the string is so complex that I don't want to create its own function.


Solution

  • there is an official github from devextreme, which handles the process from the backend side. but "raw sql" only exists in the php version. must be converted manually to c#

    https://github.com/DevExpress/DevExtreme.AspNet.Data https://github.com/DevExpress/DevExtreme-PHP-Data