walmartlabs / thorax

Strengthening your Backbone
http://thoraxjs.org/
Other
1.32k stars 120 forks source link

Incremental Loading Collections #194

Closed crisward closed 11 years ago

crisward commented 11 years ago

First of all excellent framework, its like ember but with all the backbone plugins to hand.

I'm trying to load collections in pages, to handle very large datasets. In backbone you can do this by using

this.collection.fetch({remove:false});

http://backbonejs.org/#Collection-fetch

To add to the collection, and not remove ones that didn't exist in the latest fetch. However thorax seems to be removing the models anyway. Ideas?

eastridge commented 11 years ago

@crisward can you provide a specific code example? Would love to create a failing test case for this but need some code to do so.

lyzadanger commented 11 years ago

Hi @crisward

If I understand you correctly...

I had this experience at first, but found a particular combination that seems to work for me:

{ update: true,  remove: false,  add : true }

passing that to fetch on the Thorax.Collection in question seems to do a nice job. In my case, I was implementing an infinite-loading-list sort of thing and wanted to append to the collection, as it were, but not delete.

eastridge commented 11 years ago

@lyzadanger @crisward what version of backbone are you guys using?

lyzadanger commented 11 years ago

@eastridge

{
  "name": "thorax",
  "version": "2.0.0rc9",
  "dependencies": {
    "jquery": "1.9.0",
    "underscore": "1.4.4",
    "zepto": "1.0.0",
    "handlebars": "1.0.0",
    "backbone": "1.0.0"
  },
  "gitHead": "2098cc30fe6f1125eb8cc56d15f533bed636ebd9",
   // ....
  "_id": "thorax@2.0.0rc9",
  // ...
  "repository": {
    "type": "git",
    "url": "git://github.com/walmartlabs/thorax.git"
  }
}
eastridge commented 11 years ago

Feels like this is a backbone issue more than a Thorax one. I know they changed the fetch options API between 0.9.x and 1.0. @lyzadanger does it feel like we should be doing something different here?

lyzadanger commented 11 years ago

Like I said, my situation is working just fine with the options I posted. So I'm fine...

On Jul 12, 2013, at 1:55 PM, Ryan Eastridge notifications@github.com wrote:

Feels like this is a backbone issue more than a Thorax one. I know they changed the fetch options API between 0.9.x and 1.0. @lyzadanger does it feel like we should be doing something different here?

— Reply to this email directly or view it on GitHub.

eastridge commented 11 years ago

@crisward We'll capture this in the task based documentation.