removeOld: function()
{
while (20 < this.collection.length)
{
this.removeOne(this.collection.at(this.collection.length - 1));
}
},
removeOne: function(model)
{
model.destroy();
}
this.collection.eachだと、どうもindexがズレてくるようで断念しました。。。参考:
http://backbonejs.org/#Collection-at
http://backbonejs.org/#Collection-length
No comments:
Post a Comment