Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js server side pagination

I'm using this perfectly working pagination solution.

It has a feature: it asks the server the whole set of data. I would like only a portion of it to be requested.

What do i need to do in ember-data to configure my requests so that they include some more parameters with the page info?

thank you

UPDATE: done in this way:

App.Books = Ember.Route.extend
  setupController: (controller, model) ->
    controller.set 'content', App.Book.find({page_number: controller.get('currentPage')})
like image 934
Alive Developer Avatar asked Apr 08 '26 16:04

Alive Developer


1 Answers

You can send query to find method of the DS.Model. So if you have endpoint that follows OData protocol you would do this:

App.Post.find({ '$top': 10, '$skip': 0 });

and it would return you only first 10 posts.

like image 142
Myslik Avatar answered Apr 10 '26 23:04

Myslik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!