Thanks, Andrew. Let me try your code, I will share my code later on. Yours sincerely Allan K Liu
On Aug 2, 3:43 pm, Andrew Leach <[email protected]> wrote: > On Aug 2, 4:31 am, allankliu <[email protected]> wrote: > > > 4) When marker is removed, the related entry should be removed (NOT > > YET) > > 5) When remove button in entry is clicked, the marker should be > > removed (NOT YET, BUT archiveable) > > In principle, the sidebar entries can be updated by "dragend" event, > > it should be updated by some other event such as "update content by > > post method from InfoWindows" or "remove from InfoWindows". But I am a > > newbie in JavaScript. Is there any demo for this features? By closure? > > I am not quite understanding about closure in JS. > > (5) appears to have been done. > > The issue with (4) is that when the sidebar entries are created, they > are simply created. There is no reference included in order to be able > to refer to a particular entry later on. There is a removeFeatureEntry > () function, but it's empty. > > So: you need to create a reference within the sidebar entry so you can > refer to it again. I suggest the following, but none of it is tested, > so make a copy of your code first! > > Alter line 169 of gmarkers.js to read > var cells = addFeatureEntry("Placemark " + (++markerCounter_), > color, markerCounter_); > in order that markerCounter is passed in its own right to the sidebar > function. This is the most problematic line, because we need the two > values of markerCounter to be the same and the first one increments > it. You may need to split it up like > ++markerCounter_; > var cells = addFeatureEntry("Placemark " + markerCounter_, color, > markerCounter_); > > Alter line 112 so it makes use of it: > function addFeatureEntry(name, color, number) { > > After line 113, add a new line to use that parameter: > currentRow_.setAttribute("id","PM" + number); // ids need to start > with a letter > // This adds an id attribute to the placemark's row in the table > > Then write the content of the removeFeatureEntry() function: > document.getElementById("featuretbody").removeChild("PM"+number); > // This removes the row from the tbody element > > Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
