eisenbraun / columns

A jQuery plugin that converts JSON data into searchable, sortable, HTML tables
http://eisenbraun.github.io/columns
MIT License
104 stars 47 forks source link

Ajax side paging? #1

Closed Kollibri closed 8 years ago

Kollibri commented 10 years ago

Are there any plans to implement ajax paging into columns? We would really like to use this plugin but we need to support db-side paging for extremely large datasets. If there are no plans to implement it, do you have any suggestions on how we might create a plugin for columns that would allow this?

eisenbraun commented 10 years ago

I didn't have plans to implement such a feature, but I like the idea and I excited to look into it. Can you give a little more details of what you are trying to do?

Kollibri commented 10 years ago

Certainly! =)

Basically we have a very large dataset that resides in the database and due to performance reasons we only want to receive one "page" of data at a time. We also need to know how many total records there are so that any paging elements are properly updated with the total number of pages.

So the return object from the ajax call contains both a collection of the rows, and also a property "totalCount".

As far as I can tell, there is no way currently in columns to manually override the number of pages and thereby update the paging elements.

In addition, when the page number is changed, we would want it to automatically make the ajax call with the pageNumber and pageSize parameters being passed. Or else there needs to be a way to hook into the "pageNumberChanged" and "pageSizeChanged" parameters so we can manually make the ajax call and update the dataset.

I'm kind of typing this by the seat of my pants, so if this doesn't make sense let me know and I'll try to explain better.

Thanks a ton. =)

eisenbraun commented 10 years ago

Okay, I am looking into it, and it doesn't like it will be too difficult. I fairly confident I should have something in place in the next few days. Just out curiosity, how large is your dataset?

Kollibri commented 10 years ago

Wonderful. =)

The dataset we are working with comes from a db view with over 64,000 records. Which isn't too much in the grand scheme of things but due to the complexity of the database structure, it's a view that takes a while to return results. So if we can get only a small number of results at a time (a page worth) it is quite noticeable.

eisenbraun commented 10 years ago

Columns 2.2.0 is out. There are new APIs and a new Ajax Paging plugin. I also updated the documentation (http://eisenbraun.github.io/columns/). Hopefully, this meet your needs. If you have any questions or issues, please let me know.