我正在使用集合url进行服务调用。该服务返回一些JSON,JSON长度为13(简而言之,13行数据)。... fetch()和toJSON()响应不匹配
这里,this.Collection.fetch()将返回JSON谁的长度是13 但this.Collection.toJSON()将返回JSON谁的长度是12 相反,它应该返回长度13
在集合解析中,响应返回长度为13的json,这是正确的!
tableTemplate是模板的对象(模板使用Handlebars.js完成)。
this.Collection.fetch({ 成功:函数(){
console.log("Collection Fetch 2:");
console.log(this.Collection.fetch());
console.log("Collection toJSON: ");
console.log(this.Collection.toJSON());
console.log(this.Collection.toJSON().length);
var markup = tableTemplate({List:self.importCollection.toJSON()});
...
...
}
});
一些更多的上下文会有所帮助 – JamesHalsall 2013-02-13 12:31:44
目前还不清楚在同一个集合的'fetch'回调中调用'fetch'时你期望的工作。第二个'fetch'也是异步的。 – WiredPrairie 2013-02-13 12:57:25
你能否再次审查它,并解释我在我的代码中发生了什么。 – 2013-02-13 13:17:39