PDA

View Full Version : [CLOSED] How to change store's parameter in javascript before load?



jchau
Nov 01, 2012, 5:05 PM
I can't seem to figure this out. I declare a store with parameters. After store loads, I want to reload store with new parameter. But the new parameter value never gets back to the server.

Store declaration


<ext:Store>
<Parameters>
<ext:StoreParameter Name="test" Value="InitialValue" />
</Parameters>

</ext:Store>



Reload Store


function ReloadGrid() {
var store = someGrid.getStore();
store.reload({ test: 'NewValue' });
}



Took me a long time to finally trace source code to this method. Not sure if this is a bug but the order of operation is suspect here. It is overriding the params I sent to the load function with the initial parameters declared in store markup.


buildReadParams : function (operation) {
var prms = this.readParameters(operation);

operation.params = operation.params || {};

if (prms.apply) {
Ext.apply(operation.params, prms.apply);
}

if (prms.applyIf) {
Ext.applyIf(operation.params, prms.applyIf);
}
},

Daniil
Nov 01, 2012, 5:36 PM
Hi @jchau,

Please set an IfNotExists ApplyMode.

<ext:StoreParameter Name="test" Value="InitialValue" ApplyMode="IfNotExists" />

jchau
Nov 01, 2012, 6:24 PM
Confirmed working. Thanks!