在Extjs存储中,我们可以查询2列和2个值吗?

问题描述 投票:7回答:2

我正在使用extjs(3.6)存储。

因为我们可以查询单列和一个值,所以我需要查询多列和多个值。

请建议extjs中可用的任何方法?

谢谢,

Ramanavel Selvaraj

extjs store
2个回答
16
投票

您可以使用queryBy方法

store.queryBy(function(record,id){
     return (record.get('oneField') == someValue && record.get('secondField') == otherValue);
});

0
投票

您可以使用queryBy方法。希望这个答案对您有帮助。

  getStaffName: function(staffId, departmentId){

    var staff= store.queryBy(function(record){
        return (record.get('staffId') == staffId && record.get('departmentId') == departmentId);
    });

    if (staff.getCount() > 0) {
        try {
            return staff.items[0].data.staffName;
        }catch(err) {
            console.log(err);
            return "Undefined";
        }

    }
    return "Undefined";
}
© www.soinside.com 2019 - 2024. All rights reserved.