Fixture contain list of contacts and each contact has contact type.
I am trying to filtrate contact records using .findQuery() but it is throwing following error :
Uncaught TypeError: Object function () {.....} has no method 'findQuery'
I have listed my code here :
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
}
];
Controller Code:
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')
I have changed .findQuery to .query but every time it is showing length as 0.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…