Results 1 to 2 of 2

Thread: Setting (dynamic) parameters in the designer

  1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    23

    Default Setting (dynamic) parameters in the designer

    Hello,
    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.
    Code:
     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:
    store.reload({params:{groupId:currentGroupId}});
    because the Paging Toolbar loads the store automatically.


    Thanks and kind regards,
    mannyk
    Last edited by mannyk; 18 Aug 2010 at 12:10 AM. Reason: typo

  2. #2
    Sencha User jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Frederick, MD
    Posts
    1,747

    Default

    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:
    Code:
    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:
    Code:
    store.baseParams = {
        groupId: currentGroupId
    };
    Hope that helps, let me know if you get this strategy working for you.

Similar Threads

  1. Setting Reader for JsonStore when using Designer
    By ampeer in forum Ext Designer: Help & Discussion
    Replies: 1
    Last Post: 20 Jul 2010, 10:05 AM
  2. Setting Dynamic Focus to a TreePanel
    By KEC in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 10 Mar 2010, 12:46 PM
  3. Setting dynamic content to tab
    By eagoweb in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 17 Feb 2008, 7:55 PM
  4. Help!How can i dynamic change the baseParams of store?
    By luoziseaer in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 13 Sep 2007, 1:08 AM
  5. Replies: 3
    Last Post: 31 Aug 2007, 11:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •