Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for pagination, and selective rollback for single attribute #95

Merged
merged 10 commits into from Jan 19, 2017

Conversation

mtheoryx
Copy link
Contributor

Enabled pagination of store

For example, a document model:

name: EG.attr({
  type: 'string'
});

Constructing a query for the store:

const query = {
  limit: 10,
  offset: 2
}

Will allow constructing a get request with query params so a backend server can correctly serve up just 10 documents.

You can also get the total (for pagination UI controls, next/last, X of Y, from the new property:

payload.meta.serverMeta

Selective rollback

Instead of doing a rollback on everything, a single attribute can be rolled back:

object.rollbackSingleAttribute(attribute);

Copy link
Contributor

@deleter8 deleter8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

});
})
return promise.then((payload) => {
return {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a pretty big breaking change to the API. PromiseArray extends ArrayProxy which extends Ember.Object. If you want, you could just set a meta property on the array (or something similar). This would allow the return value of a query to jive well with templates. Up to you guys though, I'm not sure what your use cases are.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also the Ember.meta function, which will probably work. I can't remember exactly how it works, but I know I've used it before. 😄

@mtheoryx mtheoryx merged commit 7df3a56 into master Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants