1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
    sendy is on a distinguished road

      0  

    Default Unanswered: Cannot read property 'data' of undefined

    Unanswered: Cannot read property 'data' of undefined


    I have this:
    var map = this.getMap();
    var store=Ext.getStore("Etablissements");
    store.load();



    var marker = new google.maps.Marker({


    position: new google.maps.LatLng((store.getAt(0).data.latitude),(store.getAt(0).data.longitude)),
    map:map

    });
    Uncaught TypeError: Cannot read property 'data' of undefined
    Any help please?

  2. #2
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Vote Rating
    20
    Answers
    64
    haduki will become famous soon enough haduki will become famous soon enough

      0  

    Default


    Code:
    store.load(function(){
        var marker = new google.maps.Marker({
    
    
            position: new google.maps.LatLng((store.getAt(0).data.latitude),(store.getAt(0).data.longitude)),
            map:map
    
       });
    });
    I write English by translator.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
    sendy is on a distinguished road

      0  

    Default


    I have tried your solution,now the map doesn't apppear.
    So I have change it like this:

    Ext.define("UnivMobile.view.Map", {
    extend : 'Ext.Container',
    requires :'Ext.Map',





    config: {


    title: 'UM Events',
    iconCls: 'locate',


    layout: 'fit',


    items: [
    {
    docked: 'bottom',
    xtype: 'toolbar',
    items: [

    {title: 'Welcome',
    iconCls: 'star'}
    ]
    }]
    },
    initialize: function() {
    var infoWindow = new google.maps.InfoWindow();
    var store=Ext.getStore("Etablissements");
    store.load();

    map = this.add({

    xtype: 'map',
    mapOptions:{
    // center : new google.maps.LatLng(itemTpl:[
    // '<div>{latitude} and {longitude} </div>'
    // ]),

    center : new google.maps.LatLng((store.getAt(0).data.latitude),(store.getAt(0).data.longitude)),
    zoom : 8,
    mapTypeId : google.maps.MapTypeId.ROADMAP,
    navigationControl : true,
    navigationControlOptions : {
    style : google.maps.NavigationControlStyle.DEFAULT
    }

    },

    listeners: {
    maprender: function(comp, map){
    var marker = new google.maps.Marker({
    position: position = new google.maps.LatLng (store.getAt(0).get('latitude'),store.getAt(0).get('longitude')),
    map: map
    });
    google.maps.event.addListener(marker, "click", function(e) {
    infoWindow.setContent('hello');
    infoWindow.open(map, marker);
    });





    }

    }
    });


    }


    }
    );

    But I still have the same error.
    Any help please

Thread Participants: 1