View Full Version : Setting (dynamic) parameters in the designer

17 Aug 2010, 11:56 PM
to implement correct paging I need to set a parameter in a gridpanel's store. However, I am not sure how to set this in the designer.

When I set the following in the Designer
{..., groupid: "currentGroupId"}

the output code of the designer looks this way and does not work.

AddressStore.superclass.constructor.call(this, Ext.apply({
storeId: 'store',
url: 'AddressData/Addresses',
root: 'addresses',
autoLoad: true,
autoSave: false,
paramNames: {
start: "start",
limit: "limit",
sort: "sort",
dir: "dir",
groupId: "currentGroupId"
fields: [
So my question is: How do I properly set parameters in the designer? That I can assign e.g. a valid groupId to the store?

Also I cannot set it this way:
because the Paging Toolbar loads the store automatically.

Thanks and kind regards,

18 Aug 2010, 5:17 AM
Hi mannyk,

You can set the your groupId variable in the "baseParams" configuration. The "paramNames" configuration is not meant for passing general variables with load rquests, but baseParams is. baseParams will be sent with every store load operation.

The Designer doesn't allow you to set an arbitrary variable name...javascript can't evaluate this because the variable would be undefined. Any dynamic variables must be set in your implementation code when the component instances are being used.

So whenever you need the groupId to change (e.g. during an event?) then you can simply set it this way:

store.baseParams = store.baseParams || {};
store.baseParams.groupId = currentGroupId;

and then the next time the store is reloaded (even by the paging toolbar) that groupId value will be sent with the request. Note: the first line will just ensure that there is an object in the baseParams, as it is undefined by default. This is a useful technique when you are setting multiple values in the baseParams and don't want to obliterate all variables...when you're only putting in a single variable, you could simply do:

store.baseParams = {
groupId: currentGroupId

Hope that helps, let me know if you get this strategy working for you.