Extend and config

Using config better.

by Walter Rumsby

HTML

<ul id="output"></ul>

JavaScript

Ext.define('My.Base', {
    extend: 'Ext.Component',
    config: {
        a: 1,
        b: 2,
        c: 3
    },
    bah: 'Gerard'
});

Ext.define('My.Sub', {
    extend: 'My.Base',
    config: {
        a: 10,
        d: 4,
        e: 5
    },
    bah: 'Prince'
});

var sub = Ext.create('My.Sub'),
    el = document.getElementById('output');

['a', 'b', 'c', 'd', 'e'].forEach(function (k) {
    var method = 'get' + k.toUpperCase(),
        html = method + ': ' + (sub[method] ? sub[method]() : undefined);
    
    el.innerHTML += '<li>' + html + '</li>';
});

el.innerHTML += Ext.String.format('<li>{0}</li>', sub.bah);