PDA

View Full Version : extraParams not working for Ext.data.HttpProxy in store.



sarathy13
8 Nov 2012, 10:39 AM
Hi,

I have created a store which load the data with server call, i have used Ext.data.HttpProxy in store, when i checked the param in java server side with pRequest.getParameter("name"), it is returning null value always even if i initialize it. I have pasted the code below.

var liveNameStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'Redirector?id=OBAAssignLiveSearch&searchType=NameSearch',
extraParams: {
_postSecurityId: '<c:out value="${_postSecurityId}"/>',
name: 'Test'
}
}),
reader : searchReader
});

I get the query by default, when i typed it in combo, the store will get loaded in combo as below.

var nameFieldCombo = new Ext.form.ComboBox({
id:'nameFieldCombo',
store: liveNameStore,
valueField: 'myId',
displayField: 'displayText',
width: 250,
minChars: 2,
pageSize:5,
typeAhead: false,
hideTrigger:true,
enableKeyEvents:true,
tpl: resultTpl,
itemSelector: 'div.search-item' ,
applyTo: 'liveSearchName',
listeners: {
select: function(combo, selection) {
document.getElementById("liveSearchName").value =selection.get('displayText');
}
}
});

Kindly let me know what is the problem with extraParam.

Sarathy

kevin.chen
8 Nov 2012, 11:45 AM
Is this for Extjs 3 or ExtJs 4?

sarathy13
8 Nov 2012, 8:18 PM
Am using 3.3.0 version... kindly let me know how i can send the parameter from store to server side.

sword-it
9 Nov 2012, 12:29 AM
Hi sarathy,

If you want post extra parameter with every http request, use baseParams config of store class like -



var liveNameStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'Redirector?id=OBAAssignLiveSearch&searchType=NameSearch'
}),
baseParams: {
_postSecurityId: '<c:out value="${_postSecurityId}"/>',
name: 'Test'
},
reader : searchReader
});


For more detail read API docs http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-cfg-baseParams