Catching loading event
See original GitHub issueHello, I want to make a spinner indicating data being refreshed. But how can I catch event for data being loaded?
Im getting data this way:
this.source = new ServerDataSource(http, { endPoint: 'https://jsonplaceholder.typicode.com/photos' });
I tried to user LocalDataSource, and manually getting data on “onSearch”:
getData(modifiedData?) {
this.loading = true;
let sourceCopy = modifiedData ? modifiedData : this.source;
let requestData = {
filter: sourceCopy.getFilter(),
paging: sourceCopy.getPaging(),
sort: sourceCopy.getSort()
}
this.service.getData(requestData).then((data) => {
this.source.load(data);
this.loading = false;
});
}
This works for search input, but this way I’d have to write pagination component on my own, while the stock one is just fine.
Any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Window: load event - Web APIs - MDN Web Docs - Mozilla
The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets, scripts, iframes, and images.
Read more >JavaScript how to catch event when lazy loaded script is ready?
I have a lazy loading JavaScript file, how can I catch the event when the class in the file is ready for usage?...
Read more >Help with "catching" an event AFTER the grid is fully loaded ...
Hello. I'm having a problem implementing the following scenario: After the grid is loaded (binding to local data), in some cases, ...
Read more >Handling Events :: Eloquent JavaScript
When a page finishes loading, the "load" event fires on the window and the document body objects. This is often used to schedule...
Read more >Resource loading: onload and onerror
There are two events for it: onload – successful load,; onerror – an error occurred. Loading a script. Let's say we need to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MrPardeep Yup Take and import this: https://github.com/akveo/ng2-smart-table/blob/master/src/app/pages/examples/server/serve.data-source.ts
In component:
In your new data-source.ts
And add to your getElements() function in data-source.ts
This link is broken. Does anybody have steps to create custom class from ServerDataSource? I managed to write something like this, but I guess there could be more elegant way:
call: