Results 1 to 2 of 2

Thread: Appending params of descendants

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    59
    Answers
    6

    Default Appending params of descendants

    Hello world,
    Heve is what i want to do:
    I have a base class (Ext.data.Store for example) with some custom parameters:
    Code:
     extraParams: {
          plugin:'documents'
    }
    I want to write a descendant of this class with this params:
    Code:
       extraParams: {
         action:'update'
    }
    and as a Result I would like to have in methods (for example in initComponent ):
    Code:
    extraParams:{
       plugin:'documents';
       action:'update'
    }
    Is there any way to do this ? or it would be more easy just define all params in descendant?

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347

    Default

    Try this
    Code:
    Ext.define('A', {
        extend: 'Ext.data.Store',
        ....
        constructor: function(config){
            var me = this;
            config = Ext.apply({}, config, {
                proxy: {
                    type: 'ajax'
                }
            });
            config.proxy.extraParams = Ext.apply({}, config.proxy.extraParams, {
                plugin: 'documents'
            });
            me.callParent([config]);
        }
    });
    
    
    Ext.define('B', {
        extend: 'A',
        constructor: function(config){
            var me = this;
            config = Ext.apply({}, config, {
                proxy: {
                    type: 'ajax'
                }
            });
            config.proxy.extraParams = Ext.apply({}, config.proxy.extraParams, {
                action: 'update'
            });
            me.callParent([config]);
        }
    });

Posting Permissions

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