PDA

View Full Version : How to send extra parameters in proxy request while paging through a grid panel?



devsaha
30 Apr 2012, 10:28 AM
Here is the store



Ext

.define(

'AM.store.Users', {extend: 'Ext.data.Store',model: 'AM.model.User',pageSize: 10,autoLoad: true,remoteSort: true,

proxy: {type:

'ajax',api: {read: 'FlexServlet'

},reader: {type:

'json',root: 'users',totalProperty: 'total'

}} })

How do i send a textfield value which has been set in a view while paging through the gridpanel as parameters?

shmeltex
30 Apr 2012, 10:47 AM
You can set extraParams

Ext.getStore('Users').getProxy().extraParams.aParamYouSendToServer = yourField.getValue();

Just keep in mind that aParamYouSendToServer will be sent with every request to the server until you remove it.

devsaha
30 Apr 2012, 10:59 AM
How do i get the object of text field?If i use Ext.Cmp with extraParams it s throwing undefined ,Heres what i tried:

alert(Ext.getCmp('parentId'));
Ext.define('AM.store.Users', {extend: 'Ext.data.Store',model: 'AM.model.User',pageSize: 10,autoLoad: true,remoteSort: true,
proxy: {type: 'ajax',api: {read: 'FlexServlet'
},reader: {type: 'json',root: 'users',totalProperty: 'total'
}},
extraParams:{paramValue:Ext.getCmp('myTextField').getValue()} });

shmeltex
30 Apr 2012, 12:13 PM
You will need to do it dynamically when your textfield is set, not through Store configuration.