View Full Version : Need to change BaseParams dynamically for Ext.data.Store

25 Oct 2007, 3:19 AM

I have grid displaying the content of a Data.Store, with paging. I want to change the BaseParams of this Data.Store dynamically, but I don't find how to do it. Is there any method to do such a thing or any other solution to would allow me to send a different query ?


25 Oct 2007, 7:41 AM
store.baseParams = {foo:'bar'}; <- replace the entire object
store.baseParams.foo= 'bar'; <- add/replace a value

The 2nd way can also be done using Ext.apply()

28 Oct 2007, 7:17 AM
Thanks, it was really too easy and efficient ! I thought that "baseParams" were only updatable at creation time... Anyway thanks !

28 Oct 2007, 8:22 AM
I've been unable to get the above method to work, it does not seem to apply for me.

28 Oct 2007, 8:41 AM
What do you mean?

I mean the statement

myStore.baseParams.paramName = "foo";

Actually does execute correctly as per the javascript standards, and set that property.

So, what exactly is happening or not happening that you expect not to happen or to happen?

28 Oct 2007, 8:42 AM
Are you sure, this isn't a Frequelknln ... http://extjs.com/learn/Ext_FAQ#I_want_to_reload_my_Grid_from_a_different_URL

28 Oct 2007, 8:56 AM
Its my fault why it wasnt working im using the following

myStore.baseParams.paramName = "foo";

PartnerTab.superclass.constructor.call(this, new Ext.Panel({}));

I was changing the baseParams before i ran the superclass and so it never applied when i needed it :(

15 Nov 2008, 4:49 AM
Hi guys,

I had the same problem when i have used a GridPanel with DataStore. The HttpProxy used for the Datastore didn't update the baseParams. But when I changed the method on the connection used on Proxy object from 'get' to 'post', it worked fine.

the code here:

var ds = new Ext.data.Store({
// proxy invokes products.do on server
proxy: new Ext.data.HttpProxy({url: 'search.dtx',method:'post'}),

// reads XML data returned from proxy & parses into Records
reader: new Ext.data.XmlReader({
record: 'Busqueda' // xml node name of record (i.e. <Busqueda><nombre></nombre>...</Busqueda>)
// Field names & xml mappings
{name: 'nombre', mapping: 'Nombre'},
{name: 'usuario', mapping: 'Usuario'},
{name: 'fecha', mapping: 'Fecha'},
{name: 'tipoDoc', mapping: 'TipoDoc'},
{name: 'peso', mapping: 'Peso'}
}); // end ds
var grid = new Ext.grid.GridPanel({
store: ds,
columns: [
{header: "Nombre", width: 300, dataIndex: 'nombre', sortable: true, id:'colNombre'},
{header: "Usuario", width: 100, dataIndex: 'usuario', sortable: true},
{header: "Fecha", width: 100, dataIndex: 'fecha', sortable: true},
{header: "Tipo Documento", width: 120, dataIndex: 'tipoDoc', sortable: true},
{header: "Peso", width: 100, dataIndex: 'peso', sortable: true}
//autoExpandColumn: 'colNombre',
title:'Panel de Resultados'

Ext.get('btn-buscar').addListener('click', load, this);
Ext.get('btn-limpiar').addListener('click', clean, this);
var textoBuscar = Ext.get('buscar');

function load(){
//ds.proxy.conn.url=ds.proxy.conn.url+ "?buscar="+ textoBuscar.dom.value;
ds.baseParams = {buscar:textoBuscar.dom.value};
ds.baseParams.buscar3= 'bar';

function clean(){

the more strange was when the Spring MVC sent an exception (I'm integrating Spring + MVC), after the proxy object didn't consider the method option

proxy: new Ext.data.HttpProxy({url: 'search.dtx'}),

the exception message was :

org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported.

Well, I think the default method is PUT on the connection object when it is ommitted.