iamisti / mdDataTable

Angular data table complete implementation of google material design based on Angular Material components.
MIT License
524 stars 132 forks source link

Refresh pagination when using AJAX column filters #306

Open angularchobo opened 7 years ago

angularchobo commented 7 years ago

Hello, I'm not very proficient in angular and I can't figure out what exactly is happening in your code.

Essentially, I am getting large data sets asynchronously and I want to be able to refresh the pagination when they're done loading. I also want to reload pagination for example when searching through the filtered content.

Can anyone give me a hint on how to achieve this?

Here is my failed attempt, forked from the AJAX filter example - https://codepen.io/anon/pen/JNVWqr

angularchobo commented 7 years ago

OK, I just figured it out - the mdt-trigger-request actually works fine, the problem was mentioned here - https://github.com/iamisti/mdDataTable/issues/196#issuecomment-261004813

For whatever reason in function paginatorCallback(page, pageSize, options) { ... } - page appears to be undefined. Simply doing if(!page) { page = 1 } makes it work fine

Hope this can help someone until a fix is out