PDA

View Full Version : combobox hot to add extra params ... queryParam?



alberto01
3 Dec 2010, 4:20 AM
Hi,
i'm trying to make a dinamyc combo box, I' ve just read the example: http://dev.sencha.com/deploy/dev/examples/form/forum-search.html

I would like to add some extra parameters to the request.

Actually when I type something I send theese params:
'start' => '0',
'limit' => '10',
'query' => 'test test'

But i need somethink like this:
'start' => '0',
'limit' => '10',
'query' => {'myCustomName': 'test test'}

How it is possible?
bye thanks!

AL

Condor
3 Dec 2010, 4:31 AM
So you need JSON syntax in url encoded data? That's a bit weird...

The easiest way to do this is to modify the parameters in the store beforeload event.

If you actually want extra parameters then those should be stored in the store baseParams.

alberto01
3 Dec 2010, 4:41 AM
Actually I have a store used by other components...
Thoose components use JSON data for some reasons...

I try to modify the params on beforeload...
tnx!

alberto01
3 Dec 2010, 4:56 AM
It works,


this.getComponent('search').getStore().on(
'beforeload',
function(ds) {
ds.setBaseParam('query',Ext.encode({'myCustomValue': search_value}));
},
this
)


tnx!

Condor
3 Dec 2010, 5:03 AM
I would recommend:

this.getComponent('search').getStore().on('beforeload', function(store, options) {
var query = options.params && options.params.query;
if (query) {
options.params.query = Ext.encode({myCustomValue: query});
}
});