1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    10
    Vote Rating
    0
    y.elqandili1 is on a distinguished road

      0  

    Default Events not fired by the view/ not catched by the controller

    Events not fired by the view/ not catched by the controller


    Hey guys it's me again, & i want to implement a controller that changes the view when the user clicks on an item pf my list. the list works fine and the itemtap works fine but I think that it doesnt fire the event. here's my code :
    the view :
    Code:
    Ext.define('Odicy.view.HotelsContainer', {    extend : 'Ext.Container',
        xtype : 'HotelsContainer',
        config : {
                iconCls : 'hotel',
                title : 'Hotels',
                layout : {
                    type : 'fit'
                }
        },
        initialize : function(){
            this.callParent(arguments);
    //        var searchfield = {xtype : 'searchfield' , placeHolder : 'Rechercher'};
            var toolbar = {
                xtype : 'toolbar',
                docked : 'top',
                title : 'Hotels et Riads Maroc'
            };
            var HotelsList ={
                xtype : 'HotelsList',
                store : 'Hotels',
                listeners : {
                itemtap : function(item, num, record, ev) {
                        console.log("This should lead to a detail view of " + item.getStore().getAt(num).get('nom'));
                        this.fireEvent("hotelDetails", this);
                        Ext.Msg.alert(this.xtype);
                        var myTxt = item.getStore().getAt(num).get('nom');
    //                    Ext.Msg.alert('Message','Tapped record : '+myTxt);
                    }
                }
            }
            this.add([toolbar, HotelsList]);
        }
        
    });
    the controller :
    Code:
    Ext.define('Odicy.controller.Hotels',{    extend : 'Ext.app.Controller',
        config : {
            ref :{
                HotelDetailsView : 'HotelDetails',
                HotelListView    : 'HotelsContainer',
            },
            control : {
                HotelListView : {
                    hotelDetails : "onHotelDetail"
                }
            }
        },
        onHotelDetail : function(){
                Console.log("here");
                Ext.Msg.alert("yup");
    //            Ext.Viewport.animateActiveItem(hotelDetails, this.slideLeftTransition);
            },    
        launch: function () {
            this.callParent(arguments);
            console.log("launch");
        }
            
    });

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    10
    Vote Rating
    0
    y.elqandili1 is on a distinguished road

      0  

    Default


    Any suggestions ?

  3. #3
    Sencha Premium Member tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,695
    Vote Rating
    114
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    Code:
    scope: this
    above the itemtap definition.
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    10
    Vote Rating
    0
    y.elqandili1 is on a distinguished road

      0  

    Default


    thanks a loot tobiu .. it really worked for me

Thread Participants: 1