PDA

View Full Version : Baseparams in a store does not work



arpho
22 Sep 2011, 10:42 AM
Hi, I have a grid with paging
the strore I am using sends POST request to a file PHP, I need to filter my db, so in the proxy of my store I use

baseParams : { provincia:'TO'}


for the moment I am usig 'TO' just for test, when it will be working, I' l put some variable, my problem is that the store does not send the parameter 'provincia', it puts only the parameters for the listing: START and LIMIT, what is wrong
these is my store



var SpaStore = Ext.create('Ext.data.Store', {


autoLoad: {start: 0, limit: myPageSize, provincia: 'to'},
autoSync: true,

model:'SPA',

proxy: {
type: 'ajax',
url: spaQuery,
actionMethods :{
read : 'POST'
},
reader: {
type: 'json',
root: 'data',
totalProperty : 'totalProperty',
baseParams : { provincia:'TO'}
},
writer: {
type: 'json'
}
},
listeners: {
write: function(postitStore, operation){
var record = operation.getRecords()[0],
name = Ext.String.capitalize(operation.action),
verb;

record = operation.records[0];
if (name == 'Destroy') {

verb = 'Destroyed';
} else {
verb = name + 'd';
}
// Ext.example.msg(name, Ext.String.format("{0} Postit id: {1}", verb, record.getId()));

}
}
});




and my grid



var grid = Ext.create('Ext.grid.Panel', {
store: SpaStore,
stateful: true,
stateId: 'stateGrid',
dockedItems: [{
xtype: 'pagingtoolbar',
store: SpaStore, // same store GridPanel is using
dock: 'bottom',
displayInfo: true,
stripeRows:true,
resizeble:true,
draggable: true,


}],
columns: [
{
text : 'nome1',
flex : 1,
sortable : false,
dataIndex: 'nome1'
},
{
text : 'nome2',
width : 1,
sortable : true,
// renderer : 'usMoney',
dataIndex: 'nome2'
},
{
text : 'indirizzo',
width : 75,
sortable : true,
// renderer : change,
dataIndex: 'indirizzo'
},
{
text : 'comune',
width : 75,
sortable : true,
//renderer : pctChange,
dataIndex: 'comune'
},
{
text : 'provincia',
width : 85,
sortable : true,
dataIndex: 'provincia'
},
/*{
xtype: 'tel1',
width: 50,
sortable : true,

dataIndex:'tel1'
}*/
],
height: 350,
width: 1200,
title: 'SPA',
renderTo: document.body,
viewConfig: {
stripeRows: true
}
});



what I am doing wrong?
any help is welkome, thanks in advance

tvanzoelen
22 Sep 2011, 10:52 AM
You must use the extraParams of the proxy instead. baseParams doesn't exists anymore

arpho
22 Sep 2011, 1:57 PM
I changed to extraParams
it does not work:((

lucasguaru
23 Sep 2011, 10:31 AM
thisGrid.getStore().getProxy().extraParams = {
param1 : '',
param2 : ''
};
thisGrid.getStore().load();