How to pass extra arguments while initial page load #1378
-
This is my existing code Html:
Component Class:
calling for external search option additional filter
Hi @ghiscoding i have some specific requirement for passing extra arguements to server, Currently when i click to search button My question is is it possible to preselected (from storage) value to slickgrid while page init ( slick grid init) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
hello, I just saw this discussion, I'm not sure why I didn't see it earlier... but anyway Maybe something along these lines export MyComponent {
isInitialLoad = true;
graphqlService = new GraphqlService();
prepareGrid() {
const initialQueryArgs = {
field: 'branchId',
value: 123
};
this.gridOptions = {
backendServiceApi: {
service: this.graphqlService,
preProcess: () => {
},
process: (query) => {
},
postProcess: () => {
this.isInitial = false, // no longer initial query
// you could maybe change the extra query params for the next query
this.changeQueryArguments();
},
options: {
extraQueryArguments: [initialQueryArgs],
}
}
}
}
changeQueryArguments() {
// update any Backend Service Options you want
this.graphqlService.updateOptions({
extraQueryArguments: [{
field: 'userId',
value: 567
}]
});
// then make sure to refresh the dataset
this.angularGrid.pluginService.refreshBackendDataset();
} After writing all of these and taking another look at the docs I wrote a while ago, there's info in this section Changing/Updating Options Dynamically to dynamically change the query params afterward. You can do many things just by using simple JS logic |
Beta Was this translation helpful? Give feedback.
hello, I just saw this discussion, I'm not sure why I didn't see it earlier... but anyway
extraQueryArguments
is meant to be used for the entire time (likeuserId
). These extra query arguments are carried for the entire time but I guess you could probably use regular JS code with a flag to reset it after the first load.Maybe something along these lines