You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const source = new ServerDataSource(this.http,
{
endPoint: `${this.apiUrl}/${uri}`,
dataKey: '',
pagerPageKey: 'pageNumber',
pagerLimitKey: 'pageSize',
filterFieldKey: 'filterBy#field#',
sortFieldKey: 'sortBy',
sortDirKey: 'orderBy',
});
source.setFilter([
{
field: 'type',
search: 'engine',
},
]); // Results in a http get request
source.setPaging(1, 1); // Results in a http get request
// Actual intentional attempt to retrieve data.
source.getElements().then(response => console.log(response));
Setting the filter calls the parent set filter which emits a filter event calling emitOnChanged leading to a http call with the currently set filter. Setting paging has the same issue.
In the docs the doEmit flag is used to determine whether or not the table is refreshed and theoretically helpful for detecting changes but what it actually does is grossly different.
The text was updated successfully, but these errors were encountered:
It looks like the ServerDataSource needs to remember the last query parameters s.t. subsequent calls to
getAll()
getElements()
getFilteredAndSorted()
can return the last result without issuing a new request. On the other hand, there needs to be a way to invalidate this "cache", because otherwise you would not get fresh data from the server.
I would override the refresh() method for this. This way you get new data from the server
every time the query changes (changing the page or the filter)
on explicit calls of refresh()
In my opinion the ServerDataSource is a bit broken anyway, because it inherits from LocalDataSource but has completely different semantics. For example I don't know what prepend or empty should mean in the context of a ServerDataSource....
Setting the filter calls the parent set filter which emits a filter event calling emitOnChanged leading to a http call with the currently set filter. Setting paging has the same issue.
In the docs the doEmit flag is used to determine whether or not the table is refreshed and theoretically helpful for detecting changes but what it actually does is grossly different.
The text was updated successfully, but these errors were encountered: