i'm very new to extjs and i'm trying to make some sense of from what i know from Jquery. I want to have an object to be used application wide as key=>val. I think that using a store is the way to go about it but i can't get i开发者_运维百科t to post any parameters. I have tried dozens of variations to call it but no luck. The code i'm using for now is
var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
method: 'POST' ,
url: '/LoadLanguage.html',
}),
autoload: true,
baseParams: {
'code' : code
},
root: '',
fields: [{name: 'Time', mapping: 'Time', type: 'int'}]
});
Problem is that the $_POST variable is always empty and the GET is like http://lordos.home.local/LoadLanguage.html?_dc=1305874986764&page=1&start=0&limit=25 I need it to post the parameters cause GET will not do. Thanx
I'm trying to understand what you're doing to please forgive me if this is just not going to work for you.
If you want to have a key=>val storage mechenisim I would suggest the KISS method and use a literal JS object to store / get the data.
// Define a namespace.
window.MyNamespace = {};
// Add my config object to hold key => balue
MyNamespace.config = {};
MyNamespace.config = {
key : 'value',
key2 : 'value2'
};
Do do an ajax request I would use...
Ext.Ajax.Request({
method:'POST', // This is the default value, here for you to see.
url:'/LoadLanguage.html',
params: {
'post_key1' : 'post_value1',
'post_key2' : 'post_value2'
},
success:function(response) {
var text = response.responseText;
MyNamespace.config.language = text;
}
});
精彩评论