2

I'm using backbone.paginator in server mode, version 2.0.2. At some point ( in backbone view file) I need to reset PageableCollection state.

Basically I need to set currentPage to 0 or my default values, either by reset or in some other way. Since state object is read-only and standard Collection methods do nothing e.g. collection.reset() is apparently not overridden by paginator.

Is there any way to do that ?

Premek
  • 99
  • 1
  • 6

1 Answers1

0

A hack solution that I used was to call collection.getFirstPage(); before the collection.fetch({reset:true});

Problem with this is that it now makes 2 REST calls instead of 1. Collection is updated correctly though.

I'll update if I find the "right" solution.

frenchmd
  • 126
  • 7
  • 1
    use 'sync' event for server mode. this.listenTo(this.collection, 'sync', this.renderPage); I have found out in (http://stackoverflow.com/questions/14676965/backbone-paginator-collection-not-triggering-render-on-reset/36093107#36093107) – Hussain Dec 27 '16 at 08:30