Topic: Using Datatable sorting and pagination with data source from API
maticdiba pro asked 5 years ago
Hi, I have a massive dataset that I would like to display with datatables. The issue is I would like to connect the source to my API. Whenever the client changes sort, pagination, enters search query, ... I would like to make call to my API with those parameters. Is there any example how to achieve that? Is that even possible or do I have to implement that from the scratch.
maticdiba pro answered 5 years ago
So right now it's impossible to capture sort event? And use it as a parameter to the api call?
Arkadiusz Idzikowski staff commented 5 years ago
Unfortunately it's impossible. Sorting function is inside mdbTableSort directive and currently there is no event that will emit new array.
Arkadiusz Idzikowski staff answered 5 years ago
We need to add an output that will emit event from mdbTableSort directive. I added this task to our list but I can't provide an ETA for this feature yet.
maticdiba pro answered 5 years ago
I know about that example. But I'm not sure how to pass information about sort change to the api as well. In this example only results on the current page are sorted if I'm right.
But I would also like to send information about sort change to my api.
Damian Gemza staff answered 5 years ago
Dear maticdiba,
We're having a DataTable example with data from remote API.
Just open our DataTables page, and at the top of the page switch tab to the Examples & Customization.
Here's the link to that example: https://mdbootstrap.com/docs/angular/tables/datatables/#e-data-from-api
Best Regards,
Damian
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.4.2
- Device: desktop
- Browser: chrome
- OS: win
- Provided sample code: No
- Provided link: No