PDA

View Full Version : Overriding Config functions within a controller



SimonCVT
19 Jan 2012, 3:07 AM
Bit of a Noob question I think,

I have a view defined as follows :



Ext.define('Views.dialogs.ItemEditor',{
extend : 'Ext.window.Window',
alias:'widget.defaultitemeditor',
height:400,
width:600,
modal: true,
border:false,
bodyBorder:false,
layout: 'border',
loadRecord: function(record,editor){console.log("called within view");}
})


I then want to override my loadRecord entry using the control function of my controller ;



this.control({
'defaultitemeditor':
{
loadRecord : function(e,f) {console.log('Fired the controller code');}
}
})


However this doesn't appear to work, I'm assuming this is because loadRecord is not actually an event and possibly can't be handled via the control method. Does anyone know how i might go about doing this?

mitchellsimoens
19 Jan 2012, 9:44 AM
Yes, this.control sets up listeners for events and loadRecord is not an event. If you are wanting to use MVC then in your window class, you should fire an event instead of use a method.