Javascript 主干网-获取型号';集合中的idAttribute值是多少?
我正在创建一个可用于不同集合的通用表视图。下面是我尝试做的一个例子:Javascript 主干网-获取型号';集合中的idAttribute值是多少?,javascript,backbone.js,Javascript,Backbone.js,我正在创建一个可用于不同集合的通用表视图。下面是我尝试做的一个例子: ... getModelIdAttribute: function () { return this.collection.__proto__.model.prototype.idAttribute; }, getModelFromRow: function (HTMLrow) { return this.collection.get(this.dataTable.row(HTMLrow).data()[th
...
getModelIdAttribute: function () {
return this.collection.__proto__.model.prototype.idAttribute;
},
getModelFromRow: function (HTMLrow) {
return this.collection.get(this.dataTable.row(HTMLrow).data()[this.getModelIdAttribute()]);
},
...
data()
函数返回一个具有用于创建模型的属性的对象,但我想说明不同的idAttributes
目前,我的方法是可行的,但是\uuuuuu proto\uuuuuuu
被弃用了,似乎应该有一种更简单的方法,我没有
谢谢问题是我拥有的对象,例如
{adminId:2,name:“troy”}
不是主干模型。我需要获取adminId值并使用它从我的集合中获取模型,但我不知道应该使用哪个值