Grid with dataSource CustomBinding CRUD using Page, Sort, Search, Filter in local data

Hi, I'm sorry to bother you again, but I'm having another problem right now.

* I'm using custom binding, exclusively for CRUD, I'm already using load, dataStateChange, dataSourceChanged, and it's working perfectly!

1- My problem is my service does not return pagination, sorting, or search, it is exclusively for CRUD,
so I need to do Page, Sort, Filter, Search on the front-end. How can I use local data treatment, for customized data?

7 Replies

PG Praveenkumar Gajendiran Syncfusion Team April 16, 2021 12:19 PM UTC

Hi  Ryan,

Greetings from Syncfusion support.

Before proceeding with your query, we need the following details to understand the query better at our end. So kindly share the following details.  

  1. Does your data will be only act as a local data in the Grid?
  2. Share your data structure example.
  3. Is that your requirement is to handle the CRUD operation for that local data in customized service
  4. Share the customized service which you have using.
  5. Please elaborate your exact requirement.

Please get back to us with the requested details. 

Regards 
Praveenkumar G 



RY Ryan April 16, 2021 01:03 PM UTC

Hello Praveenkumar,

I shared with you a sketch of what I currently use, the load event simulates a remote asynchronous service.

Currently, CRUD in this way already works for me, what does not work is the actions of filter, page, search, sorting.

I know that the way I’m working it should be done on the back end, but my back-
end does not address this, it is only for CRUD.

So I need to make these actions work as in the examples of local data, but with my custom binding
Data Grid, dataSource Custom - CodeSandbox


PG Praveenkumar Gajendiran Syncfusion Team April 19, 2021 01:48 PM UTC

Hi Ryan,

Thanks for your update.

We would like to inform you that while using custom binding we only get the current page records in the Grid(i.e., the data is retrieved only based on the pageSize by processing skip and take action). But the Grid actions like, Filtering, Sorting need to be performed on the entire records to retrieve the proper results. So with custom binding we cannot perform these actions in local source as all the Grid action needs to be done in server side and response returned back to the Grid in order to update it. 

So please share us the below information that will be helpful to validate further on your requirement, 

  1. Have you returned the entire records from the server to the client at initial request?
  2. How do you want to handle the actions in the Client side?

Regards 
Praveenkumar G  



RY Ryan April 19, 2021 05:13 PM UTC

So I would like to work as follows:

- Work with local data, so I could use the filter, search, sort, pagination.

- Work with editing in template, being able to interrupt the saving in the grid if my server's response (CRUD) is failed.

Note: I already know how to use these resources, but they are not complementary,
since I can't cancel a line addition with local data


PG Praveenkumar Gajendiran Syncfusion Team April 20, 2021 11:06 AM UTC

Hi Ryan,

Thanks for your update.

By default in EJ2 Grid we have built-in support for data Adaptors, You can use the RemoteSaveAdaptor option to perform the Grid actions like filtering, sorting and grouping in the client-side and you can perform the CRUD actions alone on the server-side. But the Datasource must be set to json property and set RemoteSaveAdaptor to the adaptor property. CRUD operations can be mapped to server-side using updateUrlinsertUrlremoveUrlbatchUrlcrudUrl properties and then return the json list data to the Grid in order to update it. 
 
For more reference, please refer to the below documentation. 
 

But while using custom binding, Grid actions and CRUD operations needs to be done in server side only and response returned back to the Grid in order to update it. 

We already requested the below details which will be helpful to provided appropriate solution on this, So please share us the below information. 

  1. What types of data are you using at your end?
  2. Share your data structure example.
  3. Share the customized service which you have using.

Please get back to us with the requested details. 

Regards 
Praveenkumar G  




RY Ryan April 20, 2021 12:22 PM UTC

The implementation I was given solves the grid's actions such as pagination, filtering, sorting, among others.

however I use asynchronous functions for my crud.
the way I want to work is to use local data, do crud, and if I update the dataSource on the server again, I would make a get call to receive the updated data

I want to be able to do paging, filtering, sorting, on the front-end and CRUD on the back-end only


PG Praveenkumar Gajendiran Syncfusion Team April 21, 2021 10:33 AM UTC

Hi Ryan,

By default in EJ2 Grid, while using RemoteSaveAdaptor, the data will be bind to the Grid as a local data and for the performing CRUD operations alone we will call the required URL (which you have given in those properties- updateUrlinsertUrlremoveUrlbatchUrlcrudUrl) 
So we have created a new incident under your Direct trac account to follow up with this query. We suggest you to follow up with the incident for further updates. Please log in using the below link.     

Regards,
Praveenkumar G 


Loader.
Up arrow icon