question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remote paginated API without ember-data

See original GitHub issue

I have a custom API that allows pagination, but I do not interface with it via ember-data. I call it directly with $.ajax passing the pagination parameters myself, and receiving the model in the json response as it is. The examples available for remote paginated api all assume one is using ember-data. Is there a way around this?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
gnapsecommented, Mar 7, 2017

@zion you can sub-class this addon’s PagedRemoteArray and override either fetchContent or rawFindFromStore (depending on the level of control you need) and put in there your own ajax data loading call and promise. The relevant file and fragment of what I’m talking about is here.

Or you can also shamelessly copy that whole class and modify it to suit your needs. Then in either case you can instantiate the resulting class as the data model in your routes. You pass to it the query params including page, perPage, etc.

0reactions
zioncommented, Mar 8, 2017

Yea, thats fair. 😃 Should have been more descriptive earlier.

After reading the readme again, I found that I needed to pass in my ajax service to the create method of the PagedRemoteArray class. Now its making the proper request but now I have an ArrayProxy error.

Error while processing route: admin.orders.index Assertion Failed: ArrayProxy expects an Array or Ember.ArrayProxy, but you passed object Error
    at assert (http://localhost:4200/assets/vendor.js:20164:13)
    at Object.assert (http://localhost:4200/assets/vendor.js:31092:34)
    at Class._setupArrangedContent (http://localhost:4200/assets/vendor.js:49490:21)
    at Class._arrangedContentDidChange (http://localhost:4200/assets/vendor.js:49480:12)
    at Object.applyStr (http://localhost:4200/assets/vendor.js:53379:20)
    at Object.sendEvent (http://localhost:4200/assets/vendor.js:31605:23)
    at ObserverSet.flush (http://localhost:4200/assets/vendor.js:34979:25)
    at endPropertyChanges (http://localhost:4200/assets/vendor.js:35517:19)
    at Object.changeProperties (http://localhost:4200/assets/vendor.js:35542:26)
    at Object.setProperties (http://localhost:4200/assets/vendor.js:36608:32)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use ember cli pagination without ember data and what ...
I want to use ember-cli-pagination but I don't use ember data. So I want to know what is the expected structure from my...
Read more >
Pagination in Ember with a JSON API Backend
Setting up pagination with a JSON:API backend is not as straightforward as it should. What is the recommended way to handle this with...
Read more >
Ember-data: Turn Frustration into Celebration - Medium
Ember-data is a powerful tool that allows ember.js developers to manage API calls and deal with the state on the front-end side.
Read more >
ember-jsonapi-pagination - npm
A JSON API spec pagination addon for ember. ... There are no other projects in the npm registry using ember-jsonapi-pagination.
Read more >
ember-cli-pagination - npm Package Health Analysis | Snyk
Sometimes you may need to handle remote paginated API without refreshModel param, to provide more smooth update of data. In that case you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found