Page 23 of 33 FirstFirst ... 132122232425 ... LastLast
Results 221 to 230 of 324

Thread: Ext.ux.GMapPanel - Google Maps

  1. #221

    Default

    Great. Got it to work.
    Thi magic line was to me: var point = new GLatLng(rec.data.lat, rec.data.lng, rec.data.marker);

    Code:
    2         emailGrid = new Ext.grid.EditorGridPanel({
    533                 title: 'Andmed',
    534                 id: 'listGrid',
    535                 store: listStore,
    536                 columns: listColumnModel,
    537                 renderTo: 'list',
    538                 width: 'auto',
    539                 stripeRows: true,
    540                 autoHeight: true,
    541                 frame: false,
    542                 plugins: this.action,
    543                 trackMouseOver: true,
    544                 //bbar: new Ext.PagingToolbar({
    545                 //      pageSize: 15,
    546                 //      store: listStore,
    547                 //      displayInfo: true
    548                 //})
    549                 tbar: [{
    550                         text: 'Lisa kirje',
    551                         tooltip: 'Lisa kirje',
    552                         iconCls:'add',
    553                         handler: displayAddFormWindow
    554                 }
    555                 ,{
    556                 text: 'Vaata kaarti',
    557                 tooltip: 'Vaata kaart',
    558                 iconCls: 'gmap-icon',
    559                 handler: function () {
    560                         myMarkers.load();
    561                         myMarkers.on('load', function(){
    562                                 myMap = Ext.getCmp('my_map');
    563                                 myMarkers.each(function(rec){
    564                                         var point = new GLatLng(rec.data.lat, rec.data.lng, rec.data.marker);
    565                                         myMap.addMarker(point);
    566                                         console.log(point);
    567                                 });
    568                         });
    569                         mapwin.show();
    570                 }
    571                 }
    572                 ]
    573 
    574         })

  2. #222

    Default

    Hi again. I have one more small problem.
    I can see my markers on map now. But I can't see marker titles.

    Here I get data from php
    Code:
    5 var myMarkers = new Ext.data.JsonStore({
    386         fields: ['lat', 'lng', 'marker'],
    387         url: 'data.php?action=getMarkers',
    388         root: '',
    389         id: 'ID'
    390 });
    My Json object is:
    [{"lat":"58.82404","lng":"25.9539","marker":""},{"lat":"58.62097","lng":"25.52935","marker":" Vene kirik "}]

    I think something is wrong with my Json object.
    If I look in to addMarker source then I am not sure what exactli is point and what exactli is marker
    Does poin need to contain title:Property or doesn't?

    Then I add it to map
    Code:
                            myMarkers.load();
    600                         myMarkers.on('load', function(){
    601                                 myMap = Ext.getCmp('my_map');
    602                                 myMarkers.each(function(rec){
    603                                         var point = new GLatLng(rec.data.lat, rec.data.lng, rec.data.marker);
    604                                         myMap.addMarker(point);
    605                                         //console.log(point);
    606                                 });
    607                         });

  3. #223
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501

    Default

    'marker' is an object, just like it is in the Google Maps API, and all of the examples I have created.

    Code:
    {
          lat: 58.86944,
          lng: 25.58701,
          marker: {title: 'Northeastern University'}
    }

  4. #224

    Default

    Tnx for your answer.
    My result is from php:
    [{"lat":"58.82404","lng":"25.9539","marker":"{lat: 58.82404, lng: 25.9539, marker:{title:'sadasdasdasas'}}"},{"lat":"58.62097","lng":"25.52935","marker":"{lat: 58.62097, lng: 25.52935, marker:{title:'sadasdasdasas'}}"},{"lat":"58.056","lng":"25.368","marker":"{lat: 58.056, lng: 25.368, marker:{title:'sadasdasdasas'}}"}]


    here you see how I assigne it:
    Code:
    myMarkers.each(function(rec){
    var point = new GLatLng(rec.data.lat, rec.data.lng);
    myMap.addMarker(point, rec.data.marker);
    console.log(rec.data.marker);
    });
    But somehow that is not an object.
    This is more like just a string: "{lat: 58.056, lng: 25.368, marker:{title:'sadasdasdasas'}}"

  5. #225
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501

    Default

    Yes, when you place quotes around text it is a string.

    That result from your PHP script is so far from what it needs to be, im not even sure where to start. You need to pick up a book on JavaScript and possibly on PHP as well, read through it and then approach this task again.

  6. #226

    Default

    Okei.
    As you see I am creating point object in same way as marker.
    And I use them in same way.
    myMap.addMarker(point, rec.data.marker);
    So I have question why point is object and marker is not But Ok tnx. I am quite strong in php but JS is not so good. So I digging into JS books.

  7. #227
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501

    Default

    Well, here is what your PHP output should look like:

    Code:
    [{
        "lat": "58.82404",
        "lng": "25.9539",
        "marker": {
            title: "sadasdasdasas"
        }
    }, {
        "lat": "58.62097",
        "lng": "25.52935",
        "marker": {
            marker: "sadasdasdasas"
        }
    }, {
        "lat": "58.056",
        "lng": "25.368",
        "marker": {
            marker: "sadasdasdasas"
        }
    }]

  8. #228

    Default

    I got it work. Tnx VinylFox.

    php code
    Code:
                     if($nbrows>0){
    160                         while($rec = mysql_fetch_array($result)){
    161                                 $rec2['lat'] = $rec['lat_d'].".".$rec['lat_m'];
    162                                 $rec2['lng'] = $rec['lng_d'].".".$rec['lng_m'];
    163                                 $rec2['marker'] = iconv("ISO-8859-1", "UTF-8", $rec['nimi']);
    164                                 $arr[] = $rec2;
    165                         }
    166                         //var_dump($arr);
    167                         return json_encode($arr);
    168                 } else {
    169                         return 0;
    170                 }
    it generates:
    [{"lat":"58.82404","lng":"25.9539","marker":""},{"lat":"58.62097","lng":"25.52935","marker":" Vene kirik "},{"lat":"58.056","lng":"25.368","marker":"Kaasiku "}]

    JS code
    Code:
                                    myMarkers.each(function(rec){
    603                                         var point = new GLatLng(rec.data.lat, rec.data.lng);
    604                                         var mrk = {lat: rec.data.lat, lng: rec.data.lng, title:rec.data.marker} 
    605                                         myMap.addMarker(point, mrk);
    606                                         console.log(mrk);
    607                                 });

  9. #229
    Sencha Premium User lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 千葉
    Posts
    666

    Question GMap redirects out of tabs

    I have a new challenge that is quite annoying at the moment...
    I'm working to enhance my blog features to use GMapPanel to display locations I have visited...

    I'm able to load the "external" page by itself with no issues.
    http://www.richiebartlett.com/blog/s....php?blogid=12

    However, when I render that same page into the tabpanel, I see the page load and the scripts start to run. Shortly after Google Maps JS code runs, the browser is redirected to a blank page! Huh?? I've added FireBug console output to assist with troubleshooting. But I'm at a loss as to why I see this issue...
    http://www.richiebartlett.com/blog/travel.php

    I see that the GMapPanel is never rendered due to this JS error :
    types[config.xtype || defaultType] is not a constructor
    /EXTjs/ext-all-debug.js
    Line 13870
    Perhaps someone could point me in the right direction?


    showThread.php GMap code:
    Code:
        var myPanel = new Ext.Panel({
                title: 'Google Mapped',
                id: "<?php echo "Blog_$blogid"; ?>",
                frame: false,
                layout: 'border',
                collapsible:  true,
                collapsed: true,
                preventBodyReset: true,
                width:400,
                height:400,
                items: {
                    xtype: 'gmappanel',
                    region: 'center',
                    zoomLevel: <?php echo $bText["geoZoom"]; ?>,
                    gmapType: 'map',
                    mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                    mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
                    setCenter: {
                        //<?php echo "$bText[geoLat], $bText[geoLng]\n"; ?>
                        geoCodeAddr: '<?php echo $bText["geoCodeAddr"]; ?>',
                        marker: {title: '<?php echo $bText["subject"]; ?>'}
                    }
                }
    
            });
            myPanel.on({
                    "beforerender": {    fn: function(){  if(Ext.isGecko) console.log(" // gMap Rendered //");}},
                    "beforecollapse": {    fn: function(){  if(Ext.isGecko) console.log(" // gMap collapsed //");}},
                    "beforeexpand": {        fn: function(){  if(Ext.isGecko) console.log(" // gMap expanded //");}}
            });
            myPanel.render("<?php echo "gMapped$blogid"; ?>");
    I'm not certain (as of yet), but it seems that Google is redirecting my page...
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...

    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.

    ================================================
    Simple. Enjoy.

  10. #230
    Sencha Premium User lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 千葉
    Posts
    666

    Lightbulb Re: GMap redirects out of tabs

    Never mind... I found the problem.

    Just FYI, if you need to run scripts from external pages (loaded into tabs)... Be sure to include the external Ext.ux.*.js scripts in the page that loads the tabs. If you try loading new external scripts from a newly loaded tab, your page can be redirected...

    I figured this out when I looked at how the scripts are added to the headers in FireBug. In this case, the "header" was the div of the tab... and that is where the redirect was forced...
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...

    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.

    ================================================
    Simple. Enjoy.

Page 23 of 33 FirstFirst ... 132122232425 ... LastLast

Posting Permissions

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