6eDesign / JSONTable

Quickly & Easily create responsive and customize-able views for virtually any JSON data-set.
MIT License
24 stars 3 forks source link

Ajax Data and Pagination #2

Open MB34 opened 10 years ago

MB34 commented 10 years ago

Does this table support loading via ajax and pagination via ajax? I don't see any docs on it.

6eDesign commented 10 years ago

Well, there are no built-in functions for doing this automatically but it should be fairly easy with JSONTable. The problem, from my perspective, is that I do not know how your server delivers JSON. Some API's might include the total number of results in the headers, others in the response.. paging can be handled in similarly varied ways.

JSONTable does provide support for the Footable-style paging but this is all client-side and probably not what you're looking for.

With all that said... it would be easy to use JSONTable for this (assuming you know a bit of JavaScript already). Essentially, you will just create a new JSONTable for each page (triggered by clicking on the pagination links). On the initial request, you will need to calculate how many pages there are, create the pagination links, and appropriately wire up their click handlers. If you need/want a little more assistance with this just let me know where you're having problems and I will see if I can help.

MB34 commented 10 years ago

We've decided to convert to use jquery DataTables, instead because of this as we were already familiar with their ajax handling. You have a good plugin but it is still a little immature for our uses. Good Luck.

6eDesign commented 10 years ago

No worries - I understand. This is only really a side project for me but I will update this issue if I find a better solution for server-side pagination. I will also look to see how jQuery DataTables handles this issue. Thanks for checking out JSONTable.