夹具包含联系人列表,每个联系人都有联系人类型。我正在尝试使用 .findQuery() 过滤联系人记录,但它会引发以下错误:
Uncaught TypeError: Object function () {.....} has no method 'findQuery'
我在这里列出了我的代码:
Grid.Store = DS.Store.extend({
revision: 12,
adapter: 'DS.FixtureAdapter'
});
Grid.ModalModel = DS.Model.extend({
fname: DS.attr('string'),
lname: DS.attr('string'),
email: DS.attr('string'),
contactno: DS.attr('string'),
gendertype: DS.attr('boolean'),
contactype: DS.attr('number')
});
Grid.ModalModel.FIXTURES = [
{
id: 1,
fname: "sachin",
lname: "gh",
email: "gh",
contactno: "4542154",
gendertype: true,
contactype: 1
},
{
id: 2,
fname: "amit",
lname: "gh",
email: "gh",
contactno: "4542154",
gendertype: true,
contactype: 2
},
{
id: 3,
fname: "namit",
lname: "gh",
email: "gh",
contactno: "4542154",
gendertype: true,
contactype: 1
}
];
控制器代码:
totpersonalcontact:function(){
return Grid.ModalModel.findQuery({ contactype: 2 }).get('length');
}.property('@each.isLoaded'),
totfriendcontact:function(){
return Grid.ModalModel.findQuery({ contactype: 3 }).get('length');
}.property('@each.isLoaded')
我已将 .findQuery 更改为 .query 但每次显示长度为 0。