我有一個簡單的模板:渲染ExtJS的組件的HTML TPL
tpl: '<table><tr><td>{LogicalCondition}</td></tr></table>',
而不是{LogicalCondition}
我希望把ExtJS的組件(動態)。
(http://jsfiddle.net/4t458yxo/2/)
Ext.define('MyApp.view.ux.form.BoolDisplayField', {
extend: 'Ext.Component',
alias: 'widget.booldisplayfield',
tpl: '<table><tr><td>{LogicalCondition}</td></tr></table>',
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
},
applyValue: function (v) {
if (v) {
this.update({
//instead of combo i am getting [object object]
LogicalCondition: Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: ["a"],
queryMode: 'local',
displayField: 'name'
})
});
}
return v;
}
});
var c = Ext.create('MyApp.view.ux.form.BoolDisplayField', {
renderTo: Ext.getBody(),
value: false
});
c.setValue(true);
你是什麼意思動態?您是否希望能夠根據數據值放置任何組件?或者您只需要一個複選框? – oldwizard 2014-10-12 18:46:14