Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the extraParams config of a proxy at runtime in extjs?

I have the following store:

var store = new Ext.data.Store({
     model: 'Result',
     proxy: {
         type: 'ajax',
         extraParams: {search_term : term},
         url : 'find.pl'
     },
});

How can I change the parameters with which the url is called (ex. search_term) at runtime?

like image 709
alex Avatar asked Jul 12 '11 14:07

alex


2 Answers

Think about it as -
You don't call the URL. You load the store.

Now, you can specify search_term value whenever you try to load the store using something like -


store.load({
    params:{
        search_term:'my runtime search term'
    }
    //other options like a callback function, append/add flag, etc. 
});
like image 101
Amol Katdare Avatar answered Sep 28 '22 04:09

Amol Katdare


Assuming that you want to change the parameters after defining the store variable. It obviously will depend whether Ext.data.Store allows the parameters to be changed. If it allows then it is as simple as: store.proxy.extraParams.search_term = //something

like image 29
Ankit Avatar answered Sep 28 '22 03:09

Ankit