backbone-paginator / backbone-pageable

DEPRECATED!!! backbone-pageable and backbone.paginator have merged. Please use backbone-paginator/backbone.paginator instead.
MIT License
343 stars 64 forks source link

Support for 'pagesInRange' which is currently supported in Paginator. #159

Closed MeoMix closed 10 years ago

MeoMix commented 10 years ago

This is a request to support the "paginator_ui: pagesInRange" property of the deprecated paginator plugin.

Consider the following scenario:

I have a client-side collection of items which is split into multiple pages. Visually, there are no "next page/previous page" buttons. The user simply scrolls up/down the collection's view. The next page of items must be appended onto the current page of items when the user scrolls downward. Once the previous page of items is outside the viewport, it could be unloaded, but not until then without being visually disruptive.

The most appropriate solution to this issue would be to re-implement the "pagesInRange" functionality of Paginator which would allow a sufficient number of pages to be loaded.

wyuenho commented 10 years ago

I'm not sure what that is but I assume that's some kind of a sliding window thing. I'm leaning on not supporting it as it plays no role in the pageable's functionality. Purely UI code should remain on the UI side. Besides, there are many ways to support sliding windows, there's no generic way to do it without replacing the formulas.

MeoMix commented 10 years ago

Well, fair enough. I'm more than content sticking with the old Paginator as it seems to do everything I need it to, but I'd still strongly push for considering this feature as I think it greatly increases the flexibility of the plugin. I don't think having a "sliding window" of pages is outside the scope of a pagination plugin.

I do agree with you that the request is UI-based, but I don't agree that just because it is needed for UI means it is out of scope.

Currently, I feed my collection into a Marionette CollectionView. The CollectionView implicitly renders all of the models in the collection. The Paginator plugin is exactly what I want -- the ability to filter away some models while presenting others. The view is presenting the models, yes, but the collection is defining what models should be rendered. The inability to define a sliding range of models to render leaves me having to re-implement the whole plugin.

In the end it's totally your project and I can appreciate wanting to defend against scope creep, so do what you will, but shocked that the plugin is going from "exactly what I need" to "not usable" as part of merger. Not stoked!

wyuenho commented 10 years ago

All you need to do extend a CollectionView and copy and paste the sliding window logic. It's not exactly difficult. It's not the goal of this project to reinvent every feature of backbone-paginator.