mutanthumb
mutanthumb

Reputation: 161

filterAll(); not working with leaflet map

I'm trying to reset a leaflet map (to its original view) after clicking on a marker using:

<h5>Location <a class="reset" href="javascript:mapLocation.filterAll(); dc.redrawAll();">reset</a></h5>

Where mapLocation is my leaflet map variable. I'm using dc.leaflet.js to link a map and datatable together. I'm driving the datatable content from the leaflet map. So when the map is reset all of the items should show in the table again.

Starting view: Map starting view

Map after clicking bubble #4: Map after clicking on #4 bubble

Then clicking on reset does not return it to it's original view.

Here is a similar use of reset with with the same problem: http://bl.ocks.org/Mbrownshoes/679a255540eb11d16704c44d88314075

Here is my code

Just modified my code from:

<h5>Location <a class="reset" href="javascript:mapLocation.filterAll(); redrawAll();">reset</a></h5>

To this:

<h5>Location <a class="reset" href="javascript:location.reload();">reset</a></h5>

That indeed refreshes the page as such resets the dc.filter, is this the best way to do it?

Upvotes: 0

Views: 293

Answers (1)

mutanthumb
mutanthumb

Reputation: 161

I ended up using:

<h5>Location <a class="reset" href="javascript:location.reload();">reset</a></h5>

To reload the whole page.

Alternatively this also worked, swapped var mapLocation with window.mapLocation

 window.mapLocation = dc.leafletMarkerChart("#location", groupname)

Upvotes: 1

Related Questions