2011-05-10 4 views
0

안녕하세요 저는 테스트 sencha touch geotwitter를 시도했지만 작동하지 않는 것 같습니다. 예 : Google지도 표시로 데모에서와 같이 각 트윗을 표시합니다.Sencha 예제가 작동하지 않습니다.

가장 인기있는 트윗을 표시하는 데 3 번째 탭을 추가하려고했습니다. 어떻게 추가할까요?

것은 내가이 데모 http://dev.sencha.com/deploy/touch/getting-started.html

http://www.youtube.com/watch?v=YdRHPSbsIhc

// JavaScript Document 
Ext.setup ({ 
    tabletStartupScreen: 'tablet_startup.png', 
    phoneStartupScreen: 'phone_startup.png', 
    icon: 'icon.png', 
    glossOnIcon:false, 
    onReady:function() { 

    var panel,timeline, mapPanel, mostPopular,tabBar, refresh; 

    timeline =new Ext.Component({ 
    title:"Timeline", 
    scroll:"vertical", 
    tpl:[ 
       '<tpl for=".">', 
       '<div class="tweet">', 
       '<div class="avatar"><img src="{profile_image_url}" /></div>', 
       '<div class="tweet-content">', 
       '<h2>{from_user}</h2>', 
       '<p>{text}</p>', 
       '</div>', 
       '</div>', 
       '</tpl>' 
     ] 


    }) 

    mapPanel = new Ext.Map({ 
    title:"Map", 
    geolocation:true 

    }); 

    mostPopular ={ 
    title:"MostPopular", 
    html:'Most Popular tweets' 

    } 

    panel = new Ext.TabPanel({ 
     fullscreen:true, 
     animation:'slide', 
     items:[mapPanel, timeline, mostPopular] 

    }); 

    refresh = function() { 
    var coords = mapPanel.geo.coords; 

     Ext.util.JSONP.request ({ 
     url:'http://search.twitter.com/search.json', 
     callbackKey: 'callback', 
     params: { 
      geocode: coords.latitude + ',' + coords.longitude + ',' + '5mi', 
      q: "healthcare ", 
      rpp: 30 
     }, 
     callback:function(data){  
       var tweetlist = data.results; 
       timeline.update(tweetlist);//update the tweets in the timeline 

       // Add point to map by looping through tweets 
       for(var i=0, ln =tweetlist.length; i<ln; i++){ 
        var tweet =tweetlist[i]; 
        if(tweet.geo && tweet.geo.coordinates) { 
         addMarker(tweet); 
        } 
       } 

     } 
     }); 

     addMarker = function(tweet){ 
     var latlng = new google.maps.Latlng(tweet.geo.coordinates); 

     var marker = new google.maps.Marker ({ 
      map:mappanel.map, 
      position:latlng 

     }); 

     google.maps.event.addListener(marker,"click", function() { 
      tweetBubble.setContent(tweet.text); 
      tweetBubble.open(mapPanel.map, marker); 
     }); 
     }; 
     tweetbubble = new google.maps.InfoWindow(); 
     /*mock statis data var tweet= { 
      text:"hello world", 
      from_user:"nelstrom", 
      profile_image_url:"http://bit.ly/nelstrom-avatar" 
     }; 
     var tweetlist =[tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet, tweet] 
     timeline.update(tweetlist);// update the tweets in the timeline 
     */ 
    } 
    tabBar = panel.getTabBar(); 
     tabBar.addDocked ({ 
     dock:'right', 
     xtype:'button', 
     ui:'plain', 
     iconMask:true, 
     iconCls:'refresh', 
     align:'center', 
     handler:refresh 


     }); 

     mapPanel.geo.on('locationupdate',refresh); 
    } 


    }); 

답변

0

한 가지 고려해야 할 다음되었다 당신이 당신의 파일이 마커를 가지고있는지도를 위해 어딘가에서 (원격 서버) 호스팅 한 필요가있다. 또는 Android 및 Android 휴대 전화를 사용하는 경우 컴퓨터에 연결하여 응용 프로그램을 실행할 수 있습니다. 그러면 모든 마커를 볼 수 있으며 응용 프로그램도 사용자의 위치를 ​​감지합니다.

다른 옵션은 컴퓨터에 iphone 에뮬레이터를 설치 한 다음 에뮬레이터 브라우저에서 프로젝트 파일이있는 로컬 호스트를 가리키는 것입니다.

var mostPopular = Ext.TabPanel{ 

    //put your logic here... 
} 

나도이 꽤 새로운 오전 :

지금 세 번째 탭을 추가하기 위해, 당신은 ... 이런 어떤 유형 탭의 새로운 객체를 인스턴스화해야합니다. 여기에 좋은 비디오 (들) 튜토리얼 (들) 나는 매우 찾았지만, 나도이 문제를 가지고

http://vimeo.com/22251762

0

매우 유용하지만 쉽게 해결할 수 있었다. html 파일에서 파일 소스를 수정해야합니다. 당신은 내가 생각하는 것과 같은 것을 가지고 있습니다.

<!-- Sencha Touch CSS --> 
    <link rel="stylesheet" href=" /sencha/sencha-touch.css" type="text/css"> 

    <!-- Custom CSS --> 
    <link rel="stylesheet" href=" /stylesheets/geotweets.css" type="text/css"> 

    <!-- Google Maps JS --> 
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> 

    <!-- Sencha Touch JS --> 
    <script type="text/javascript" src=" /sencha/sencha-touch.js"></script> 

    <!-- Application JS --> 
    <script type="text/javascript" src=" /javascripts/geotweets.js"></script> 

그러나 소스에서 슬래시 "/"를 제거해야합니다. 예 : '/javascripts/geotweets.js'는 'javascripts/geotweets.js'이어야합니다.

관련 문제