1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    9
    Vote Rating
    0
    vaskito is on a distinguished road

      0  

    Question Cannot add listener to Map. Please help!

    Cannot add listener to Map. Please help!


    After solving my problem with the markers I got another problem. This time, I can't add a listener (using either on or addListenermethods) after creating the panel with the map.
    Any help would be much appreciated. Here's the code:
    Code:
    Ext.setup({
    ...
    onReady: function() {
    
    
        var TopBar, Tabs, MapHome, Viewport, Homecard, Nearbycard, updateNearby;
    
    
        /* 
         *      HOME
         */
        var markersHome = [];
        MapHome = new Ext.Map({
            id: "maphome",
            title: 'Map',
            useCurrentLocation: true,
            listeners: {
                centerchange: function(comp, map){
                    deleteOverlays(markersHome); //defined on another file
                    addMarker(markersHome,map.center); //defined on another file
                    showOverlays(markersHome,map); //defined on another file
                }
           },
            mapOptions : {
                mapTypeControl : false,
                navigationControl : false,
                streetViewControl : false,
                backgroundColor: 'transparent',
                disableDoubleClickZoom: true,
                zoom: 17,
                draggable: false,
                keyboardShortcuts: false,
                scrollwheel: false,
                mapTypeId: google.maps.MapTypeId.HYBRID
           }
        });
    
    
    
    
        Homecard = new Ext.Panel({
            title: "home",
            id: "homecard",
            iconCls: "home",
            items: [MapHome]
        });
    
    
        /* 
         *      NEARBY
         */
        Nearby = new Ext.List({
            scroll: 'vertical',
            height: '100%',
            styleHtml: true,
            store: new Ext.data.Store({
                model: 'Places', //defined on another file
                sorters: 'title',
                data: []
            }),
            itemTpl:['<div class="nearby-item" id="{id}">',
                        '<img alt="{title}" src="{imageUrl}" />',
                        '<h2>{title}</h2>',
                        '<p>{excerpt}</p>',
                    '</div>']
        });
    
    
        Nearbycard = new Ext.Panel({
            fullscreen: true,
            iconCls: "list",
            title: "nearby",
            id: "nearbycard",
            items: [Nearby]
        });
    
    
        updateNearby = function() {
            console.log('updating!'); //debug purposes
            }
        MapHome.on('locationupdate',updateNearby); // <-- Here is the problem
    
    
    
    
    
    
        /*
         *      MAIN
         */
    
    
        TopBar = new Ext.Toolbar({
            dock: 'top',
            xtype: "toolbar",
            title: "<img class='titleLogo' src='css/images/logo.png' />",
            items: [
    
    
                { xtype: 'spacer' },
                {
                    iconCls: 'settings9',
                    iconMask: true,
                    text: 'options'
                }
            ]
        });
    
    
        Tabs = new Ext.TabPanel({
            id: 'tabs',
            //fullscreen:true,
            dock: 'bottom',
            flex: 1,
            tabBar: {
                dock: 'bottom',
                layout: {
                    pack: 'center'
                }
            },
            items: [ Homecard, Nearbycard ]
        });
    
    
        Viewport = new Ext.Panel({
            fullscreen:true,
            layout:{type:'vbox',align: 'stretch'},
            ui:'dark',
            items: [TopBar,Tabs],
        });
     }
    });

    I keep getting this error on the line with the MapHome.on code:

    Uncaught TypeError: Cannot read property 'element' of undefined

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    9
    Vote Rating
    0
    vaskito is on a distinguished road

      0  

    Default RESOLVED

    RESOLVED


    Fixed it. I had an error defining the variables. Code above is now correct.

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