EJ2 Grid - Set multiple parameters at once

Hello, we have a grid that is reused across 4 separate screens in an SPA.  We are dynamically changing the dataManager, filterSettings, and the query based on the screen when a person clicks on the menu.  Everything works perfectly as expected EXCEPT for when you set those 3 items it hits the database each setting.  Is there a way to group them so this does not happen?  Specifically, the endpoint being called runs 10 queries on the server to return the data and because setting it is hitting it 3 times immediately it runs the same 10 queries 3 times for a total execution of 30 on the server.  Its a standard grid that has already been created and loaded and here is our menu code to change parameters dynamically:

var predicate = new ej.data.Predicate('award_status', 'equal', 'Submitted Pending Validation')
.or('award_status', 'equal', 'Validated Pending Approval')
.or('award_status', 'equal', 'Returned for Validation')
.or('award_status', 'equal', 'Validation Denied');
award_approval_grid.filterSettings = {
columns: [{ field: 'award_status', matchCase: false, operator: 'equal', predicate: 'and', value: 'Submitted Pending Validation' },],
};

award_approval_grid.dataSource = award_validate_dataManager;
award_approval_grid.query = new ej.data.Query().where(predicate);

This is what we are trying to get to:

award_approval_grid = {
filterSettings: {
columns: [
{
field: 'award_status',
matchCase: false,
operator: 'equal',
predicate: 'and',
value: 'Submitted Pending Validation'
},
],
},
dataSource: award_validate_dataManager,
query: new ej.data.Query().where(predicate)
};

Any thoughts on how to achieve this?

3 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team January 26, 2021 09:08 AM UTC

Hi Mark, 
 
Greetings from Syncfusion support. 
 
Based on the provided information we would like to let you know that when remote data is bound to the Grid using any data adaptor, it will send request to the server for every Grid action like, filter, sort, query, etc. Since you are performing three Grid actions here - Updating the Grid filter settings, query modification and data change, the Grid will send three separate requests for performing each action. This is the Grid’s default behavior with remote data. 
 
If your requirement is to avoid sending all the requests at once, then these actions can be executed on success of the previous action. For this you can use the Grid’s dataBound event handler(which gets triggered each time Grid data is updated) with global flag variables to indicate and perform the actions for avoiding infinite loops as this event will be triggered for each data change. 
 
 
If we misunderstood your query or if you require any further assistance, then please get back to us. 
 
Regards, 
Sujith R 


Marked as answer

MA Mark January 27, 2021 05:19 PM UTC

Thank you.  We will see if we can figure out a workaround then.  Thanks!


PK Prasanna Kumar Viswanathan Syncfusion Team January 29, 2021 03:58 AM UTC

Hi Mark, 
 
Thanks for the update. 
 
We will wait to hear from you. 
 
Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon