EloquentStudio / filter.js

Complete solution for client side filtering and rendering using JSON data
http://eloquentstudio.github.io/filter.js
MIT License
664 stars 183 forks source link

Support for paged JSON in streaming #45

Open craigmdennis opened 10 years ago

craigmdennis commented 10 years ago

I'm using the script with the Wordpress JSON API plugin to generate the data. The API has currentCount, totalCount and page properties but I can't seem to use the streaming options from filter.js as it expects the JSON to be in one file.

Unfortunately this causes some issues as the JSON output is paged. I can output a single file but this causes performance issues.

So is it possible to add support for paged JSON in streaming?

jiren commented 10 years ago

Yes using paged JSON it is possible but it is not a correct approach. streaming enabled filter.js send request like

yourjsonapiurl?offset=0&limit=100 Next: yourjsonapiurl?offset=100&limit=100 yourjsonapiurl?offset=200&limit=100

So on server side you have to handle this limit and offset and return json data according to it.