PDA

View Full Version : renderTo and this.control in controller



ostghost
12 Oct 2012, 8:18 AM
Hi,

I have dataview with tpl. In controller refresh event of dataview is catched and Ext.form.Panel with textarea and button are added. Till now OK. Controller is subscribed to dynamically added components, so this.reply is called when button click is fired.

Is there way how to use query widgetpost button[action="reply"] or widgetpost dataview button[action="reply"] ... instead of only button[action="reply"]?

Component is rendered to DOM and due to this there is probably no "connection" with widgetpost but I don´t want to mess up "global namespace" with common word / buttons actions like reply, send.



// init and set controll
init:function () {
this.control({
'widgetpost dataview':{
itemclick:this.itemClickWidgetDataView,
refresh:this.refresh
},
'button[action="reply"]':{
click:this.reply
}
});
},

// reply function
reply: function(me) {
alert(me);
},

// refresh function
refresh:function (me) {
var renderSelector = Ext.query('.commentTextArea');
for (var i in renderSelector) {
Ext.create('Ext.form.Panel', {
renderTo:Ext.get(renderSelector[i]),
border:false,
layout:{
type:'hbox'
},
items:[
{
xtype:'textarea',
height:20
},
{
xtype:'button',
text:'reply',
action:'reply'
}
]
});
}
},

scottmartin
12 Oct 2012, 8:51 AM
Sure.. you can qualify using your alias name from your view:


'app-list-users button[action=addUser]' : {
click : me.addUser
},

Scott.