PDA

View Full Version : How can I ADD to baseParams rather than overwrite one set of baseParams with another?



vibez
23 Aug 2007, 11:11 PM
How can I ADD to baseparams rather than overwrite one set of baseparams with another?

For eaxmple,

I have two parts of my grid's code using baseParams

This is a snippet from my grid filtering code that sets adds params called filter_name & filter_col to my baseParams


if (filterValue.length>0) {
ds.baseParams = {"filter_col":filterCol,"filter_name":filterValue};
}

Then we have some more code here that grabs results from a form as also adds them to my baseParams


ds.on('beforeload', function() {
ds.baseParams = { // modify the baseParams withs values from the forms
Division:combo.getValue(),
Area:combo2.getValue(),
Dept:combo3.getValue(),
CostCentre:multiselect.getValue(),
PlantRegister:multiselect2.getValue(),
PlantItem:multiselect3.getValue(),
Elect:checkboxElect.getValue(),
Manuf:checkboxManuf.getValue(),
Mech:checkboxMech.getValue(),
Struct:checkboxStruct.getValue(),
StatusBoth:StatusBoth.getValue(),
StatusDue:StatusDue.getValue(),
StatusOverdue:StatusOverdue.getValue()
};
});

Notice how the last snippet uses beforeload. I need this as the values set in beforeload must persist. I believe this overwrites the baseParams, because filter_name & filter_col no longer get sent with my POST. Although they do get sent if I remove the the beforeload event.

Can anyone suggest what I am doing wrong here?

Animal
23 Aug 2007, 11:13 PM
baseParams.foo = "bar"; http://www.mysmiley.net/imgs/smile/confused/confused0076.gif

Animal
23 Aug 2007, 11:14 PM
Ext.apply(baseParams, {
foo: "bar",
bletch: "blivit"
});


http://www.mysmiley.net/imgs/smile/confused/confused0039.gif

vibez
31 Aug 2007, 11:54 PM
Thanks Animal :)