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

setOtherParam #244

Open
vanness145 opened this issue May 13, 2018 · 3 comments
Open

setOtherParam #244

vanness145 opened this issue May 13, 2018 · 3 comments

Comments

@vanness145
Copy link

image

setOtherParam will force the ember-cli-pagination to re-fetch current page.. However in my case, it would not work if I were to re-fetch the current page for the second time..

image

I looked into page-remote-array.js and found out that it doesnt run this.fetchContent() when setOtherParam was fired second time onwards because the lastPage was set to page..

Any idea hw to get this work? I need setOtherParam to re-fetchContent every time it was called..

@broerse
Copy link
Collaborator

broerse commented May 13, 2018

Perhaps something like this will fix your problem.

  lastPage: null,
  lastParamsForBackendCounter: null,

  pageChanged: Ember.observer("page", "perPage", function() {
    var page = this.get('page');
    var lastPage = this.get('lastPage');
    var paramsForBackendCounter = this.get('paramsForBackendCounter');
    var lastParamsForBackendCounter = this.get('lastParamsForBackendCounter');
    if (lastPage != page || lastParamsForBackendCounter != paramsForBackendCounter) {
      this.set('lastPage', page);
      this.set('lastParamsForBackendCounter', paramsForBackendCounter);
      this.set("promise", this.fetchContent());
    }
  }),

I don't know what impact this would have. @alejandrodevs can you take a look while thinking about the remote redesign.

@ppkpp
Copy link

ppkpp commented Nov 11, 2020

solved ? i faced the same problem on ember octane

@broerse
Copy link
Collaborator

broerse commented Nov 11, 2020

@ppkpp I never implemented this code because I don't oversee what impact it would have on others. Do you think it would break something?

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

3 participants