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

Infinity model and server side filtering #156

Closed
mphasize opened this issue May 5, 2016 · 2 comments
Closed

Infinity model and server side filtering #156

mphasize opened this issue May 5, 2016 · 2 comments

Comments

@mphasize
Copy link

mphasize commented May 5, 2016

Hi again. :)

Following the instructions here https://github.com/hhff/ember-infinity#infinitymodel I added ComputedProperties to the InfinityModel request url, because I thought this would be great for implementing server side filtering together with pagination.

What I found though, is that when the CP's change, the InfinityModel is not triggered for a reload. The new CP values are only applied when the next page is requested from the server, which of course, also upsets the paging since filtered records have a completely different page count.

Alright, so ... am I completely out of scope of ember-infinity?
If not, is filtering a valid use case for the CP parameters in InfinityModel? Or should I trigger a complete reload of the whole Route.model() hook instead?

If filtering should be possible with InfinityModel (now or future) then I guess, some thoughts should go into:

  • watch ComputedProperties for changes
  • figure out if they change the expected result set (i.e. filtered)
  • reset paging
  • replace model with new records and update paging meta information

Any ideas would be highly appreciated! :-)

@hhff
Copy link
Collaborator

hhff commented May 5, 2016

hi @mphasize ! That's expected behavior on the ember-infinity side. To replace everything - you should use Route#refresh when changing the bound values :)

@mphasize
Copy link
Author

mphasize commented May 5, 2016

@hhff Thanks for the quick response! I feared it would be like that... ;-)
I had hoped otherwise, because doing a full transition with Route.refresh clears away my whole outlet until the model() hook resolves – which looks awful in the app I'm working on. Looks like we need to find a different solution then. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants