2014-02-15 16 views
0

我想將一些數據粘貼到我的地圖對象上,以便當我點擊它時,我可以將其作爲啓動的一部分對話。假設stopId:val [2]確定(它沒有中斷,但指令擴展了,但是沒有擴展方法給L.circle,所以我現在只希望將它插入),我該如何引用它?。如何將數據添加到.on(「click」)中使用的傳單對象

       mapobject=L.circle([Lat,Lon], 1000, { 
            color: 'green', 
            fillColor: 'green', 
            fillOpacity: 1, 
     // do I need to extend L.circle in order to so this 
            stopId : stopId_for_this_station 
           }).addTo(map) 
           .on("click",function(e) { 

    // my dialog uses the current value of the accompanying select list to go fetch 
    // the data for the form. so I just need to emulate the act of selecting from 
    // the list and we're ready to go 

    //THIS LINE WILL BREAK IT OF COURSE, but how do you get hold of an option value anyway  
     // $("#select-StopTimes").val(e.target.stopId); 


     $("#dialog-edit-StopTimes").data("edit_flag",true); 
     $("#dialog-edit-StopTimes").dialog("open"); 
     }); 
+0

我得到的東西由具有全球關聯數組工作的價值\t \t \t \t \t mapobjectToValue [MapObject的] = stopId_for_this_station;哪些工作,但會咬我最終 –

+0

當然我需要去L.stamp(mapobject)。它現在可以工作,但它仍然是褲子。 –

回答

1

您可以只設置mapobject.data = 'foobar'和閱讀e.layer.data

相關問題