Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Extract Latitude and Longitude from model and create a map marker

  1. #21
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Vote Rating
    1
      0  

    Default

    Thanks for the reply! I tried it out, unfortunately doesn't work, if this helps,

    this is my 'NewsContainer' which is my navigation view which contains 'New' which is where my list is, its a carousel.

    NewsContainer:
    Code:
    Ext.define('demo.view.NewsContainer',{
       extend:'Ext.navigation.View',
       xtype:'newscontainer',
       
       requires: [
    		'demo.view.New',
    		'demo.view.Mapo'
       ],
       
        config:{
            title:'Home',
            iconCls:'home',
    		cls: 'home',
    		
            items:[
                {
    				itemCls: 'feed',
    				style: 'background-color: Transparent;',
                    xtype:'new'
                }
            ]
        }
    
    
    });
    New.js (Carousel) which contains 'list' which is the first item of my carousel.

    Code:
    Ext.define('demo.view.New',{
        extend:'Ext.Carousel',
        xtype:'new',
    	
    	requires:['Ext.plugin.PullRefresh'],
    	
        config:{
            title:'Traffic Watch',
            iconCls:'home',
            layout:'fit',
    
    
            items:[
                {
    				plugins: [
                        {
                            xclass: 'Ext.plugin.PullRefresh',
                            pullRefreshText: 'Pull down to refresh!'
                        }
                    ],
    				itemCls:'xmlfeed',
                    xtype:'list',
                    store:'news',
    				html:['<center><b><font face= "Dosis" size="5" color="blue">LTA Newsfeed</font></b></center>'].join(""),
    				style: 'background-color: Transparent;',
                    itemTpl: new Ext.XTemplate(
                        '<div style="float-left; width:60px;">',
                        '</div>',
                        '<div style="margin-left: 40px;">',
                        '     <img src={[this.getImagePath(values)]} /><br><br><h1>{Message}</h1>',
                        '</div>'
    					, {
    						getImagePath: function (values) {
    							 if (values.Message.indexOf("Roadworks") != -1) {
    								return 'resources/images/roadworks.png';
    							 }
    							 else if (values.Message.indexOf("Accident") != -1) {
    								return 'resources/images/accident.png';
    							 }
    							 else if (values.Message.indexOf("breakdown") != -1) {
    								return 'resources/images/breakdown.png';
    							 }
    							 else {
    								return 'resources/images/heavytraffic.png';
    							 }
    						}
    					}
                    )
                },
    			{
                    plugins: [
                        {
                            xclass: 'Ext.plugin.PullRefresh',
                            pullRefreshText: 'Pull down to refresh!'
                        }
                    ],
                    itemCls:'userdisplay',
                    xtype: 'list',
                    itemId: 'DisplayList',
    				style: 'background-color: Transparent;',
                    html:['<center><b><font face= "Dosis" size="5" color="blue">User Newsfeed</font></b></center>'].join(""),
                    itemTpl: [
                        '<div style="float-left; width:60px;">',
                        '</div>',,
                        '<div style="margin-left: 62px;">',
                        '     <h1><b>@{username}</b></h1><br><h2>{description}<br><br><br>{time}</h2>',
                        '</div>'
                    ],
                    store: 'Displays'
    
    
                }
            ]
        }
    });
    Thank you for all your help, been struggling with this school assignment for a while now.

  2. #22
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    101
      0  

    Default

    Quote Originally Posted by daftwolfie View Post
    Mapo:
    Code:
    for (i=0; i<Ext.getStore('news').getData().length; i++){
                var data = Ext.getStore('news').getData().items[i].data
            };
                new google.maps.Marker({
                    position: new google.maps.LatLng(
                            data.Latitude, 
                            data.Longitude
                    ),
                    // icon: image,
                    map: map,
                    title: "Incident Location",
                    animation: google.maps.Animation.BOUNCE
                });
    The var data is just going to be 'overwritten' every step of the loop. You would have to create the map marker inside the loop. Doesn't the editor you use give you an alert saying the var 'data' is never read or used?

  3. #23
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Vote Rating
    1
      0  

    Default

    Thanks Jerome! I'll see what I can do to get around this, been using notepad++ , a bad idea I guess. Thanks for all the help you've given, really appreciate it!

  4. #24
    Sencha User
    Join Date
    Sep 2013
    Location
    Ahmedabad
    Posts
    10
    Vote Rating
    0
      0  

    Default

    hi thank you for replay..
    when I run this app give error like : can not call method 'apply' undefined..
    plz help me..

Page 3 of 3 FirstFirst 123

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •