parameters - ExtJS - Load store with params -
i'm trying load store params in order filter data (as "where" in sql) didn't find how ... therefore, made filter on store load in order make when there many data, lags appears because load data , filter them.
is possible load store params ? tried example :
store.load({ params: { id : '300'}, });
but it's not working ..
here code; (i'm using extjs3.4 in groupoffice module (mvc model) that's why can see "go.", ... ).
i declare store
go.gestionfrais.storeaffichagemesfrais = new go.data.jsonstore({ url: go.url('gestionfrais/frais/store'), // url model fields: ['id',...], // method: 'post', // have write line ? // read: 'post', model: 'go\\gestionfrais\\model\\frais', });
then created filter:
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); });
and load store
go.gestionfrais.storeaffichagemesfrais.load( /*{params ?}*/ );
thanks reading me.
edit 1:
i have modify store declaration following mindparse link :
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', });
then tried load store params (id=320) , can see in header :
query string parameter
--> r:gestionfrais/frais/store
--> security_token:ity...form data
--> id:320
--> sort:id
--> dir:asc --> security_token:ityc ....
my param isn't in "query string parameters", normal ?
use proxy configuration send params controller :
store.proxy.extraparams = { id1 : '300', id2: '22', ... }; store.load();
Comments
Post a Comment