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 Unanswered: Controller problems: Argh !

    Unanswered: Controller problems: Argh !


    Hello everyone,

    I'm pretty new to Sencha Touch (and ext js really). So this is probably a noob-ish question and/or a silly mistake.
    I'm trying to call my controller on the tap of a button in a view.

    Here is my view code :
    Code:
    Ext.define("documind.view.Search", {    extend: 'Ext.tab.Panel',
        alias: 'viewSearch',
        requires:[
            'Ext.TitleBar',
            'Ext.form.*',
            'Ext.field.*',
            'Ext.Button'
        ],
        config: {
            tabBarPosition: 'bottom',
            ui: 'light',   
            activeTab: 1,
            defaults: {
                scrollable: true,
                 layout: {
                    align: 'middle',
                    type: 'hbox'
                },
            },
            items: [
            {
                xtype:'container',
                title:'Home',
                iconCls: 'home',
                flex: 1,
                layout: {
                    align: 'center',
                    type: 'vbox'
                },
                fullscreen: true,
                items:[   
                    {           
                        //Row 1
                        items:[
                        {
                            xtype: 'button',
                            id: 'rcSearch',
                            text: rcSearch,
                            iconCls:'search', 
                            margin: 5,
                            iconMask:true,
                        }]
                    }]
            }]
        }      
    });

    And my controller :
    Code:
    Ext.define('documind.controller.searchController', {
        id: 'searchController',
        alias: 'searchController',
        extend : 'Ext.app.Controller',
        config : {
            refs: {
                searchView: 'viewSearch',                         
            },
            control : {
                searchView : {
                    '#rcSearch' : {
                        select : 'searchEvent'
                     }
                }
            }
        },
        
        searchEvent: function(){
            alert('Search');
        }
    
    
    });
    Am I not meant to call the id of my component in the controller ? viewSearch > rcSearch --> then the function I need ?

    I'm so confused !

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Answers
    11
    Vote Rating
    7
    george.m is on a distinguished road

      0  

    Default


    Try this:

    Code:
    config : {
            refs: {
                searchView: 'viewSearch',                         
            },
            control : {
                searchView : {
                    '#rcSearch' : {
                        tap : 'searchEvent'
                     }
                }
            }
        },
    and use itemId instead of if on your button. See if that works.

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

      0  

    Default Thanks

    Thanks


    Thank you for your quick reply, but neither work
    I had already tried 'tap' and then thought that select might work but nada !

    But it doesn't generate an error, I can't figure it out
    Any another ideas ?

    Thank you again

    Sarah

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Answers
    11
    Vote Rating
    7
    george.m is on a distinguished road

      0  

    Default


    Sorry I made a typo, I meant to say change your button 'id' to 'itemId'.

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Answers
    11
    Vote Rating
    7
    george.m is on a distinguished road

      0  

    Default


    Also, in your view, set its alias to:

    Code:
    alias: 'widget.viewSearch'

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

      0  

    Default Tried

    Tried


    I've also tried that. Doesn't seem to work.
    On tap on the button, nothing happens at all.

    So it should be this :
    Code:
     itemId: 'rcSearch'
    and in the controller :
    Code:
     control : {
                searchView : {
                    '#rcSearch' : {
                        tap : 'searchEvent'
                     }
                }

    So that means I'm doing something wrong somewhere else ?

  7. #7
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Answers
    11
    Vote Rating
    7
    george.m is on a distinguished road

      0  

    Default


    Ohh, well I do event firing differently. I use the method in this video: http://docs.sencha.com/touch/2-1/#!/...etting_started

    If you're still struggling with your method, use the one in the vid.

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