Hello.. I am playing around on a pilot project with this wonderful
Rails plugin.... thanks for sharing it w us !
I read in a post , in reply to this subject yjat :
Events are possible. Either through the @map.record_init "azeazeae"
(for
arbitrary events like domlistener) or through the
@map.event_init(@map,:click,"function(){alert(''HOYOYO'');}").
The latter will give you: GEvent.addListener(map,"click",
function(){alert(''HOYOYO'');}) inserted during initialization.
I succeeded to do it in an rjs file (called from a form.. whenc
changing a location.. )
but I need to setup a first marker from my index action as I
initialize the map
I wrote
def index
@code_postal = "75018"
@map = GMap.new("map_div")
@map.control_init(:large_map => true,:map_type => true)
@adresses = []
@adresses = lookup_geocodes(@code_postal << ", france")
@adresses.each do |marker|
@latitude = marker[:latitude]
@longitude = marker[:longitude]
@marker1 = GMarker.new([marker[:latitude],marker
[:longitude]], :draggable => "true", :title =>
"myTitlei", :info_window => "myInfo...")
end
@map.overlay_init @marker1
@map.center_zoom_init([@latitude, @longitude],16)
@map.event_init(@map,:click,"function(){alert(''HOYOYO'');}")
#
this runs well... testing..
@map.event_init(@marker1, :dragend, "function () { point =
marker1.getPoint(); map.setCenter(point); map.savePosition();
GLog.write(''New position of insert = ''+ point.lat() +
'',''+
point.lng()); });")
# this one doesn''t fire up..... as it does in rjs
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/ym4r-user/attachments/20070304/f1fc8026/attachment.html