Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    58
    Answers
    7
    Vote Rating
    0
    novadys-sbu is on a distinguished road

      0  

    Default Answered: Passing controller to view problems

    Answered: 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

  2. Because downloadButton is an Ext component so its event can be catched by controller.
    Code:
    {
        id: 'downloadButton',
        xtype: 'button',
        scope: this,
        text: 'Download',
    //  handler:function(){ <- no need
    //      Ext.Msg.alert("Download button tapped");
    //      //CALL CONTROLLER HERE ???
    //  }
    }
    Controller
    Code:
        init:function(){
             this.control({
    //            'viewViewer':{
    //                downloadButton : this.downloadDocument
    //            }
                '#downloadControl': {
                    click: this.downloadDocument
                }
            });
        },

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Because downloadButton is an Ext component so its event can be catched by controller.
    Code:
    {
        id: 'downloadButton',
        xtype: 'button',
        scope: this,
        text: 'Download',
    //  handler:function(){ <- no need
    //      Ext.Msg.alert("Download button tapped");
    //      //CALL CONTROLLER HERE ???
    //  }
    }
    Controller
    Code:
        init:function(){
             this.control({
    //            'viewViewer':{
    //                downloadButton : this.downloadDocument
    //            }
                '#downloadControl': {
                    click: this.downloadDocument
                }
            });
        },

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi