I looked at the pagination at https://gist.github.com/838460 and it all seems very difficult for what I'm looking for.
I want to do endless scrolling like paging, and I'm new to the spine, so maybe I just don't underestimate it.
what I thought I would do was get the first collection, click the "Next" button and get the results and just add it to the original collection and display the newly added items.
So, I have this in my router. I have an index function.
if (! myApp.list) {
myApp.list = new myApp.collections.list;
myApp.list.page = 1;
} else {
myApp.list.page ++;
}
myApp.list.url = '/ recipes? page =' + myApp.list.page;
myApp.list.fetch ({
add: true,
success: function () {
new myApp.views.list ({collection: myApp.list});
},
error: function () {
new Error ({message: "Error loading documents."});
}
});
which will create the collection if it does not exist, and if it exists, increase the "page" before requesting the following items in the list.
So, the first part of my question is: is there something wrong with this way? It seems a lot easier than other solutions I've seen.
Question # 2 seems ridiculous, but how do I then launch the Next button to get the following list?
In my opinion, I have a "next" button, but calling myApp.routers.list.index or myApp.views.list does not give me an updated list.
source share