Results 1 to 2 of 2

Thread: Merging instance configs with class config recursively

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium User
    Join Date
    Mar 2009
    Posts
    254

    Default Merging instance configs with class config recursively

    Hi, I am trying to do a Ext.Config.merge as per this thread:
    https://www.sencha.com/blog/using-sencha-ext-config/

    Basically we have a lot of remote combos in our application, and I am trying to reduce the boilerplate code. So here's a class definition:

    Code:
    Ext.define('Imbibe.App.Ext.Form.ApiComboBox', {
        extend: 'Ext.form.field.ComboBox',
        xtype: 'itnet-apicombobox',
    
    
        config: {
            queryMode: 'remote',
            minChars: 0,
            forceSelection: true,
    
    
            store: {
                $value: {
                    xtype: 'json',
                    remoteSort: false,
                    pageSize: 25,
                    autoLoad: false,
                    proxy: {
                        type: 'apiajax',
                        actionMethods: { read: 'POST' },
                        reader: {
                            type: 'apijson',
                            rootProperty: 'data',
                            totalProperty: 'total'
                        }
                    }
                },
    
    
                merge: function (newValue, oldValue) {
                    var val = Ext.merge(newValue, oldValue);
                    return (val);
                }
            }
        }
    });
    Here's how I try to instantiate it:
    Code:
    {
        xtype: 'itnet-apicombobox',
        name: 'dmPublisherId',
        fieldLabel: t('Publisher'),
    
    
        displayField: 'name',
        valueField: 'dmPublisherId',
    
    
        store: {
            fields: ['dmPublisherId', 'name'],
            proxy: {
                url: Imbibe.App.Url.resolveApiUrl('Kira/Publisher/Find'),
            }
        }
    }
    As per the reference blog page, my expectation is I should be getting the raw $value object from class definition as oldValue inside the merge function. However what I get is a plane object with all primitive properties removed:

    Code:
    {"proxy":{"actionMethods":{},"reader":{}}}
    Is this the expected behaviour? I mean it would really help to eliminate a lot of redundant code if we can merge full objects from class definition and instance config.

  2. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    The issue here is that the combo isn't really setup to deal with the store being an Ext.Config config. The default behaviour for objects is to merge them.

    Here's an example of a class that is expecting configs: https://fiddle.sencha.com/#view/editor&fiddle/260p

Similar Threads

  1. Access configs of a class without instantiating class?
    By jonjanisch in forum Sencha Ext JS Q&A
    Replies: 2
    Last Post: 29 Oct 2014, 8:09 AM
  2. Recursively search for config-data and callback
    By tdobberphul in forum Sencha Ext JS Q&A
    Replies: 1
    Last Post: 17 Sep 2014, 2:17 PM
  3. Replies: 1
    Last Post: 27 May 2013, 7:58 PM
  4. Difference between properties and configs for the class
    By Priyaranjan.m in forum Ext: Q&A
    Replies: 1
    Last Post: 15 Oct 2012, 9:07 PM
  5. Can I apply pre-configured configs to an existing Ext class?
    By ang89 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 23 Aug 2009, 7:27 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
  •