views:

426

answers:

1

Hi, I have the following issue. I have a google map (using YM4r + Geokit) within Ruby on Rails, anyhow, i basically have an array of markers which are populated in the following manner

@shops.each do
|sto|
     markers << GMarker.new (....)
end

They are definitely being stored fine as under 10 markers they are displayed just fine. The problem arises when there are more than 10 markers on the same page,

Further code related to displaying if this may help:

@map.overlay_global_init(GMarkerGroup.new(true, markers), "sto_markers")

in the html.erb file:

<%= GMap.header %>
<%= javascript_include_tag("markerGroup") %>
<%= @map.to_html%>
<%= @map.div(:width => 700, :height => 500)%>

Only 10 markers are displayed on screen instead of the correct amount in the markers array.

Has anyone ever encountered this issue please? i'm really at a loss on how to overcome this please

A: 

Hmm, I have never used these plugins (I prefer to work directly with the API, much easier :)), so this is just random thinking.

Have you looked in the source of the rendered HTML? In there you should have a Javascript Object or Array with all your markers defined. If all of them do show up there, then it is easier to pinpoint if the problem is on the Javascript or the Rails side. (That is what <%= @map.to_html%> should do unless I'm completely off).

Update:

After some looking into the plugin, I can't really tell what the error can be, however since it do put out everything in clear Javascript in the file, it would probably help a lot if you can post the rendered HTML source. I believe that you will find the solution by looking there.

Jimmy Stenke
Thank you so much , a simple yet extremely effective solution. By looking into the html output, i realised that 70 or so markers where in fact being created and displayed on map! The problem was that accidentally i was scraping off the same page each time instead of going onto the next one! thank you soo much
Erika