0

I'm attempting to fetch data from MySQL (with a PHP-based API) using Backbone. I want to retrieve items in batches of 20 though. For example, I have 10,000 records, but only want to show 20 records upon page load. As the user scrolls down I'd like to load the next 20 every time they reach the bottom of the page. My query is not sorted by ID (by design), so that may add one level of complexity. How is this possible in Backbone?

1 Answer 1

3

I recommend to use this plugin https://github.com/backbone-paginator/backbone.paginator

Sign up to request clarification or add additional context in comments.

4 Comments

Yeah, have been looking through this, and am connecting to my API fine, but not sure how to set the API get requests to respond to what the paginator sends over (I'm sending data over in json, not jsonp.
This is not a problem, you can configure your query in the paginator_core object. Just remove dataType: 'jsonp' - Infinite Pagination example addyosmani.github.io/backbone.paginator/examples/….
Thanks. But how does the paginator modify my MySQL script so it's only pulling 20 items at a time from the database? Is that how it works? Do I need to set the LIMIT in my sql statement according the query parameter?
Oh, this is another question. I'm not a backend developer and cannot recommend you how to implement server API in that case. Please take a look at this question stackoverflow.com/questions/13872273/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.