Reputation: 3
I created a BackendService for Salesforce with SlickGrid Universal 5.2.0. And I was insert the console.log into the every functions to confirm execution order.
Here is BackendService.js I tested. I didn't add any business logic into BackendService, only console.log added. So I just want to confirm execution order.
export class BackendService {
options = { ... }
init(serviceOptions, pagination, grid, sharedService){
...
console.log('backend service init finished');
}
updateFilters(columnFilters, isUpdateedByPresetOrDynamically){
console.log('backend service updateFilters method');
}
updateSoters with just console.log like updateFilters;
updatePagination with just console.log like updateFilters;
updateOptions with just console.log like updateFilters;
buildQuery(){
console.log('backend service buildQuery');
return 'SELECT Id, NAME FROM Account';
}
postProcess(respone){
console.log('backend service internalPostProcess ', response);
}
processOnFilterChanged(..){
console.log('backend service onFilterChanged');
return this.buildQuery();
}
processOnSorterChanged(..){
console.log('backend service onSorterChanged');
return this.buildQuery();
}
processOnPaganationChanged(..){
console.log('backend service onPaganationChanged');
return this.buildQuery();
}
}
And, here is gridOptions
gridOptions = {
...,
presets : {
...
},
backendServiceApi : {
service : new BackendService();
options : { ... },
preProcess: () => {
console.log('backend servie preProcess');
},
process: (query) => {
console.log('backend service process ', query);
return [];
}
postProcess: (response) => {
console.log('backend service postProcess ', response);
}
}
};
console.log('grid initialization start');
this.grid = new GridBundle(el, columns, gridOptions, []);
console.log('grid intialized -> ', this.grid)
It is run as following orders at initialization of grid.
Excution order of the function 'bindBackendCallbackFunctions()' in the source code 'slick-vanilla-grid-bundle.ts' is correct I think. preset > buildQuery > preProcess > process.
However, real excution order is different as below. preset > buildQuery > process > preProcess, how can I solve this?
I believe correct execution orders are:
For onInit exection order : init > preset > buildQuery > preProcess > process > internalPostProcess > postProcess
For event excution order : preProcess > eventHandler > buildQuery > process > internalPostProcess > postProcess
Upvotes: 0
Views: 17