Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery$.grep不使用主干网”;此.model.attributes“;_Javascript_Jquery_Backbone.js - Fatal编程技术网

Javascript jQuery$.grep不使用主干网”;此.model.attributes“;

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

这有点奇怪。我已经无数次使用了$.grep函数,但现在它的功能与正常情况不同

我在主干的this.model.attributes变量中得到了20个对象

var daySubjects = $.grep(this.model.attributes, function(e){
     console.log(e);
     return e.dayIndex == dayIndex;
});
daySubjects不返回任何内容。而且控制台.log(e)不会记录任何内容。即使this.model.attributes看起来像是一个数组


请帮忙

模型
用于键值对。如果要存储一组数据,请使用
Collection
。 此外,我还建议使用下划线方法进行数据操作,而不要考虑jQuery
each
filter

var daySubjects = _.filter(this.collection.models, function(model) {
     return model.get('dayIndex') == dayIndex;
});

模型
用于键值对。如果要存储一组数据,请使用
Collection
。 此外,我还建议使用下划线方法进行数据操作,而不要考虑jQuery
each
filter

var daySubjects = _.filter(this.collection.models, function(model) {
     return model.get('dayIndex') == dayIndex;
});

模型
用于键值对。如果要存储一组数据,请使用
Collection
。 此外,我还建议使用下划线方法进行数据操作,而不要考虑jQuery
each
filter

var daySubjects = _.filter(this.collection.models, function(model) {
     return model.get('dayIndex') == dayIndex;
});

模型
用于键值对。如果要存储一组数据,请使用
Collection
。 此外,我还建议使用下划线方法进行数据操作,而不要考虑jQuery
each
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(函数(模型){/**/})