EXTJS中按int字段过滤存储

EXTJS中按int字段过滤存储,extjs,odata,Extjs,Odata,我有一个模型和一个商店,非常好用。我可以从odata的来源得到这些记录。我的问题在于没有正确过滤商店 型号 Ext.define('CostClass', { extend: 'Ext.data.Model', idProperty: 'CostClassID', fields: [{ name: 'CostClassID', mapping: 'WBSCostClassID', type: 'int' }, { name: 'Class', mapp

我有一个模型和一个商店,非常好用。我可以从odata的来源得到这些记录。我的问题在于没有正确过滤商店

型号

Ext.define('CostClass', {
    extend: 'Ext.data.Model',
    idProperty: 'CostClassID',
    fields: [{ name: 'CostClassID', mapping: 'WBSCostClassID', type: 'int' },
          { name: 'Class', mapping: 'Class', type: 'string' },
          { name: 'WBSCostSetID', mapping: 'WBSCostSetID', type: 'int' },
          { name: 'CostClassID', mapping: 'WBSCostClassID', type: 'int' },
          { name: 'UseForCAC', type: 'boolean'}]
});
商店

var valueStore = Ext.create('Ext.data.Store', {
        //autoLoad: true,
        autoSync: true,
        model: 'CostClass',
        remoteFilter: true,
        sorters: { property: 'Class', direction: 'ASC' },
        proxy: {
            type: 'odata',
            url: siteUrl + "_vti_bin/PerformancePortalData.svc/WBSCostClasses",
            noCache: false,
            sortParam: undefined,
            limitParam: undefined,
            startParam: undefined,
            pageParam: undefined,
            headers: {
                'Accept': 'application/json'
            },
            reader: {
                type: 'json',
                root: 'd'
            }
        }
    });
valueStore.filter([{ property: 'WBSCostSetID', value: 2, exactMatch: true}]);
过滤代码

var valueStore = Ext.create('Ext.data.Store', {
        //autoLoad: true,
        autoSync: true,
        model: 'CostClass',
        remoteFilter: true,
        sorters: { property: 'Class', direction: 'ASC' },
        proxy: {
            type: 'odata',
            url: siteUrl + "_vti_bin/PerformancePortalData.svc/WBSCostClasses",
            noCache: false,
            sortParam: undefined,
            limitParam: undefined,
            startParam: undefined,
            pageParam: undefined,
            headers: {
                'Accept': 'application/json'
            },
            reader: {
                type: 'json',
                root: 'd'
            }
        }
    });
valueStore.filter([{ property: 'WBSCostSetID', value: 2, exactMatch: true}]);
这将生成一个Odata调用,看起来像
\u vti\u bin/PerformancePortalData.svc/WBSCostClasses?$filter=WBSCostSetID eq“2”
,但该URI给出以下错误:

Operator 'eq' incompatible with operand types 'System.Int32' and 'System.String' at position 13.
显然,我需要这个调用看起来像
$filter=WBSCostSetID eq 2
,但是如何更改过滤器代码才能做到这一点

看了报纸后,我仍然不知所措。然而,另一个给了我答案的线索

显然(即使文档中没有),有一个
类型
参数,因此我的筛选代码只需要更改为以下内容(注意添加的类型:“int”):