PDA

View Full Version : deleting an extraParam



da_b0uncer
7 May 2013, 2:55 AM
delete oStore.getProxy().extraParams['filter'];
oStore.load();


I can re-set the filter param, which works fine, but deleteting it results in the last value, before the delete, getting sent to the server again.

slemmon
9 May 2013, 8:50 AM
Seems to work ok for me using the below example / data:

grid / store


Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
proxy: {
type: 'ajax',
url: 'data/json.json',
reader: {
type: 'json',
root: 'items'
},
extraParams: {
foo: 'bar'
}
}
});


var grid = Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody(),
tbar: [{
text: 'Load',
handler: function () {
grid.getStore().load();
}
}, {
text: 'Remove Param and Load',
handler: function () {
delete grid.getStore().getProxy().extraParams['foo'];
//grid.getStore().getProxy()
grid.getStore().load();
}
}]
});



data


{"items":[
{ "name": "Lisa", "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ "name": "Bart", "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ "name": "Homer", "email":"home@simpsons.com", "phone":"555-222-1244" },
{ "name": "Marge", "email":"marge@simpsons.com", "phone":"555-222-1254" }
]}