Reputation: 2378
I want to make a grid with server side pagination sorting and filtering, i have all set on the back-end with Rails and active-models-serializers, currently i managed to do it with datatables.net plugin and plain JS/JQuery, but ATM i want to migrate the front-end to EmberJS, till the moment all i can find are some examples with ArrayController and Pageable-Mixings doing some kind of client side pagination which don't work for me on this application. Is there any datables.net replacement in the EmberJS ecosystem?, any help is appreciated.
Upvotes: 1
Views: 559
Reputation: 19050
Datatables.net has been around for a while and is pretty full-featured. I'm not aware of any 1-1 replacement in the EmberJS ecosystem. That said, ember-table is pretty awesome and might be a good fit for your app. For sure it can render a grid backed by server-side pagination/sorting/filtering.
To see how pagination works, checkout the table-with-ajax example. It uses the github api to lazy-load one page (30 rows) of data at a time. I've not tried but you could extend that example to support server-side sort and filter by:
Resetting the content array whenever your sort/filter properties change:
content: Ember.computed ->
App.TableAjaxExample.LazyDataSource.create
content: new Array(@get('numRows'))
.property 'numRows', 'sort', 'filter'
and then using those properties when requesting data from your server:
url = "https://api.github.com/repos/emberjs/ember.js/events?page=#{page}&per_page=30&sort=#{sort}&filter=#{filter}&callback=?"
Upvotes: 1