ember-cli-pagination icon indicating copy to clipboard operation
ember-cli-pagination copied to clipboard

setOtherParam

Open vanness145 opened this issue 6 years ago • 3 comments

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..

vanness145 avatar May 13 '18 10:05 vanness145

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.

broerse avatar May 13 '18 12:05 broerse

solved ? i faced the same problem on ember octane

ppkpp avatar Nov 11 '20 07:11 ppkpp

@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?

broerse avatar Nov 11 '20 08:11 broerse