Javascript jQuery$.grep不使用主干网”;此.model.attributes“;
这有点奇怪。我已经无数次使用了$.grep函数,但现在它的功能与正常情况不同 我在主干的this.model.attributes变量中得到了20个对象Javascript jQuery$.grep不使用主干网”;此.model.attributes“;,javascript,jquery,backbone.js,Javascript,Jquery,Backbone.js,这有点奇怪。我已经无数次使用了$.grep函数,但现在它的功能与正常情况不同 我在主干的this.model.attributes变量中得到了20个对象 var daySubjects = $.grep(this.model.attributes, function(e){ console.log(e); return e.dayIndex == dayIndex; }); daySubjects不返回任何内容。而且控制台.log(e)不会记录任何内容。即使this.mod
var daySubjects = $.grep(this.model.attributes, function(e){
console.log(e);
return e.dayIndex == dayIndex;
});
daySubjects不返回任何内容。而且控制台.log(e)不会记录任何内容。即使this.model.attributes看起来像是一个数组
请帮忙
模型
用于键值对。如果要存储一组数据,请使用Collection
。
此外,我还建议使用下划线方法进行数据操作,而不要考虑jQueryeach
、filter
等
var daySubjects = _.filter(this.collection.models, function(model) {
return model.get('dayIndex') == dayIndex;
});
模型
用于键值对。如果要存储一组数据,请使用Collection
。
此外,我还建议使用下划线方法进行数据操作,而不要考虑jQueryeach
、filter
等
var daySubjects = _.filter(this.collection.models, function(model) {
return model.get('dayIndex') == dayIndex;
});
模型
用于键值对。如果要存储一组数据,请使用Collection
。
此外,我还建议使用下划线方法进行数据操作,而不要考虑jQueryeach
、filter
等
var daySubjects = _.filter(this.collection.models, function(model) {
return model.get('dayIndex') == dayIndex;
});
模型
用于键值对。如果要存储一组数据,请使用Collection
。
此外,我还建议使用下划线方法进行数据操作,而不要考虑jQueryeach
、filter
等
var daySubjects = _.filter(this.collection.models, function(model) {
return model.get('dayIndex') == dayIndex;
});
欢迎您,也可以使用
this.collection.filter(函数(模型){/***})
欢迎您,也可以使用this.collection.filter(函数(模型){/***})
欢迎您,也可以使用this.collection.filter(函数(模型){/***}
欢迎您,您还可以使用this.collection.filter(函数(模型){/**/})