PDA

View Full Version : Store baseParams as json object



dahrens
3 Mar 2010, 3:15 AM
Hi forum,

i'd like to pass an object in json notation as baseParam for a stores request.

The Code looks like this:



filterCriteria = {"person": 'all', "period": 'all'};
this.store.setBaseParam('tx_fhhforschungsprojekte_txfhhlibmain_fhhforschungsprojektetxfhhforschungsprojekteforschende[filter]',filterCriteria);
The problem is, that the post value, that is sent to the server looks like this:



tx_fhhforschungsprojekte_txfhhlibmain_fhhforschungsprojektetxfhhforschungsprojekteforschende[filter][object Object]
There store's basaParams property looks fine after the call. Any hints where to start debugging?

regards
Dennis

fay
3 Mar 2010, 3:29 AM
Take a look at the Ext.util.JSON.encode() (http://www.extjs.com/deploy/dev/docs/?class=Ext.util.JSON) method. Something like:


this.store.setBaseParam('tx_fhhforschungsprojekte_txfhhlibmain_fhhforschungsprojektetxfhhforschungsprojekteforschende[filter]', Ext.util.JSON.encode(filterCriteria));

dahrens
3 Mar 2010, 3:34 AM
thanks a lot fay - works like a charm ;)

regards
dennis