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

Resetting the starting page? #91

Closed
ghost opened this issue Sep 18, 2015 · 4 comments
Closed

Resetting the starting page? #91

ghost opened this issue Sep 18, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 18, 2015

HHFF -- great work with this package, it's been really easy-breezy so far. It's been working great at the basics, but I have run into an issue with a bound parameter and maybe I'm just doing it wrong.

I am passing a bound filter parameter called "year", and want to dynamically change which year I am looking at with a select. I have successfully bound this parameter and it's doing what I expected with one slight caveat...

I default to 2015, which has 2 pages to load. When I switch to 2014 and clear the store for my model (resetting the list, essentially) it loads the first page as page 2 of 2 instead of page 1 of 2 as a new set of pages to load from.

What is the best practice here? Should I reload the page with a query parameter for year and just do it that way or is there a way to do it without a refresh by just resetting the startingPage parameter of the InfinityModel?

@ghost
Copy link
Author

ghost commented Sep 18, 2015

Here's the example code:

https://github.com/prowrestler-io/play.prowrestler.io/blob/example/app/routes/promotions/promotion/rosters.js

applicationModel is just an interface for the infinityModel method. I have moved all of the setup stuff into a mixin class to keep my routes a little slimmer.

@ghost
Copy link
Author

ghost commented Sep 18, 2015

Looks like #90 is pretty close to what I need so I am gonna close this!

Much appreciation to the hard work being done on this to HHFF and cohorts 👍

@ghost ghost closed this as completed Sep 18, 2015
@DuBistKomisch
Copy link
Contributor

I've been calling this.refresh() on the route, similar to #78 except run through Ember.run.debounce to prevent spamming the server as the user types. I also use an observer on the property instead of making it a query param. It seems to work as expected, and is smooth from the user perspective. It does internally trigger a route transition though unfortunately.

To be honest, when I first started implementing it, I assumed infinityModel would actually observe the bound properties, and automatically reset from page 1 when they change. Some documentation clarification on this whole area would be great.

@hhff
Copy link
Collaborator

hhff commented Nov 16, 2015

a PR would be great @DuBistKomisch 👍

This issue was closed.
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