ExtJS-使用参数加载存储

ExtJS-使用参数加载存储,extjs,parameters,load,store,extjs3,Extjs,Parameters,Load,Store,Extjs3,我正在尝试加载带有参数的存储,以便过滤我的数据(在SQL中为“where”),但我没有找到如何做到这一点。。。 因此,我在store load上做了一个过滤器以实现这一点,但是当有很多数据时,会出现延迟,因为它加载所有数据,然后对它们进行过滤 是否可以使用参数加载存储?例如,我试过: store.load({ params: { id : '300'}, }); 但它不起作用 这是我的密码; (我在GroupOffice模块(MVC模型)中使用ExtJS3.4,这就是为什么您可以看到

我正在尝试加载带有参数的存储,以便过滤我的数据(在SQL中为“where”),但我没有找到如何做到这一点。。。 因此,我在store load上做了一个过滤器以实现这一点,但是当有很多数据时,会出现延迟,因为它加载所有数据,然后对它们进行过滤

是否可以使用参数加载存储?例如,我试过:

store.load({
     params: { id : '300'},
});
但它不起作用

这是我的密码; (我在GroupOffice模块(MVC模型)中使用ExtJS3.4,这就是为什么您可以看到“GO.”,…)

我申报我的商店

GO.gestionfrais.storeAffichageMesFrais = new GO.data.JsonStore({                
url: GO.url('gestionfrais/frais/store'), // URL to my model
                fields: ['id',...], 
//              method: 'POST', // Have I to write this line ?
//              read: 'POST',
                model: 'GO\\Gestionfrais\\Model\\Frais',
        });
然后我创建了我的过滤器:

GO.gestionfrais.storeAffichageMesFrais.on('load', function(){
     GO.gestionfrais.storeAffichageMesFrais.filterBy( function(record, id) { 
          if(record.get("id_user") == id_currentUser && record.get('archive') == 'Non' ) { 
               return true;
          }
          return false;
     }, this);
});
最后我加载了我的商店

GO.gestionfrais.storeAffichageMesFrais.load( /*{params ?}*/ );
谢谢你读我的书

编辑1: 我已通过以下mindparse链接修改了存储声明:

GO.gestionfrais.storeAffichageMesFrais = new GO.data.JsonStore({
        // store configs
        autoDestroy: true,
        url: GO.url('gestionfrais/frais/store'),
        storeId: 'storeAffichageMesFrais',
        // reader configs
        root: 'results',
        idProperty: 'results',
        fields: ['id', 'id_user', 'user', 'id_resp','demandeur', 'mois', 'prixTotal', {name: 'dateCreation', type: 'date', dateFormat: 'd-m-Y'}, 'etat', {name: 'dateSoumission', type: 'date', dateFormat:'d-m-Y'}, 'archive', {name: 'dateValidation', type: 'date', dateFormat: 'd-m-Y'}], // On récupère les champs qui nous intéressent (soit ceux à afficher).
        //Added
        model: 'GO\\Gestionfrais\\Model\\Frais',
});
然后我尝试加载带有参数(id=320)的存储,我可以在标题中看到这一点:

查询字符串参数
-->r:gestionfrais/frais/store
-->安全令牌:ITy

表单数据
-->id:320
-->排序:id
-->目录:ASC -->安全令牌:ITyc


我的参数不在“查询字符串参数”中,正常吗?

使用代理配置向控制器发送额外的参数:

store.proxy.extraParams = { id1 : '300', id2: '22', ... };
store.load();

您的商店定义看起来很奇怪,与文档相比,我看不到任何根属性集,例如感谢您的快速回答@mindparse。我在你的链接中做了同样的例子,但是我的参数仍然不起作用。。当我查看文件的标题时,我可以看到我的URL和securityToken位于“查询字符串参数”中,而我的参数(一个id)位于带有排序的“表单数据”(reader?)中。谢谢您的回答。但是它不起作用。。我在我的“编辑1”中用我的存储区尝试了它,并输入了以下代码:
GO.gestionfrais.storeAffichageMesFrais.proxy.extraParams={id:'2'};GO.gestionfrais.storeAffichageMesFrais.load()但是我的商店没有加载参数。正如我在“编辑1”中所说,使用“params”时,它正在加载表单数据,而使用“proxy.extraParams”时,我在Http头中看不到我的id。。。