PDA

View Full Version : [CLOSED] ViewController fireViewEvent missing?



tolgaerdogus
30 May 2014, 3:46 AM
I am trying to follow the http://www.sencha.com/blog/using-viewcontrollers-in-ext-js-5 blog post and implement the ViewController's ability to bubble up events by calling fireViewEvent.

In a form panel I have:

buttons: [{
text: 'Save',
reference: 'saveButton',
scope: 'controller',
listeners: {
click: 'onSaveGroupButtonClicked',

}
}


Then I have:

Ext.define('MyApp.controller.EditGroupViewController', {
extend: 'Ext.app.ViewController',
alias: 'controller.editgroupview',


onSaveGroupButtonClicked: function () {
this.fireViewEvent('saveGroup', this, null);
}
});


onSaveGroupButtonClicked is called and 'this' appears to be the controller instance (is my scope: 'controller' declaration correct?) but there is no fireViewEvent method on it. What am I doing wrong?

Thanks

mitchellsimoens
30 May 2014, 3:49 AM
This is a method that will be new to the next release. Here is an override for now:


Ext.define('Override.app.ViewController', {
override : 'Ext.app.ViewController',

fireViewEvent : function() {
var view = this.getView();
view.fireEvent.apply(view, arguments);
},

lookupReference : function(ref) {
return this.getReference(ref);
}
});

Make sure you remove this override when the next release is released.