Passing controller to view problems
Hello everyone
So I need a button in my mobile app to download a document.
My problem is with the binding between my view and my controller.
It seems that quite a few people have had this problem. Is there any way out ?
Here is my code :
In my view I have a button like so
Code:
{
id: 'downloadButton',
xtype: 'button',
scope: this,
text: 'Download',
handler:function(){
Ext.Msg.alert("Download button tapped");
//CALL CONTROLLER HERE ???
}
}
And this is my controller :
Code:
Ext.define('documind.controller.DocumentController',{ //Init params
extend: 'Ext.app.Controller',
stores: ['Archives'],
models: ['Viewer'],
views: ['Viewer'],
singleton: true,
alias: 'DocumentController',
/**
* Main function of the controller
* It redirects the user event to the corresponding function
* Created : 30-12-12
* Author : Sarah Burrell
*/
init:function(){
this.control({
'viewViewer':{
downloadButton : this.downloadDocument
}
});
},
downloadDocument: function(){
console.log("Download document");
}
});
If anyone has any ideas I will be very very grateful !!
Sarah