-
16 Jul 2012 9:46 AM #1
using this in xtype definition
using this in xtype definition
I can't get "this" to work in an class definition:
Ext.define('classname', {
extend: 'Ext.form.Panel',
layout: 'form',
labelMap: {
textfieldLabel: 'write your name here'
},
items: [{
xtype: 'textfield',
fieldLabel: this.labelMap.textfieldLabel
}]
});
why ?
-
16 Jul 2012 11:07 AM #2
Please have a look at the following:
You need to initialize before you start adding items.
Regards,Code:Ext.define('classname', { extend: 'Ext.form.Panel', layout: 'form', height: 100, width: 100, labelMap: { textfieldLabel: 'write your name here' }, initComponent : function () { var me = this; Ext.applyIf(me, { items: [{ xtype: 'textfield', fieldLabel: this.labelMap.textfieldLabel }] }); me.callParent(arguments); } }); Ext.create('classname', { renderTo: Ext.getBody() });
Scott.


Reply With Quote