javascript - Leaflet popup clears content on first close -
for app i'm using leaflet , went pretty far it, i'm sure understood "leaflet way" of getting things done.
as have 1 static layout of markers created simple mustache template, inserts variable data , gives me html:
can.view("leads/popup", viewoptions)
this works expected , results in html string, gets displayed.
but when close , reopen popup results in empty popup content.
var popup = l.popup({maxwidth: 1000, closeonclick: true}, marker); popup.setcontent(can.view("leads/popup", viewoptions)); var marker = l.marker(l.latlng(lng, lat), {icon: l.divicon({ classname: 'lead-icon lead_'+lead._id.$oid, iconsize: [size, size], html: '<span class="marker-label">' + label + '</span>' }) }); marker.bindpopup(popup); self.displaymarker(marker);
what thought extending l.popup class , set _content fixed html code. i'm unsure if isn't little bit overpowered.
thanks lot help,
stephan
ok found point failed:
can.view
returns documentfragment seems work in initial build.
in l.popup
source found line of code match type against string - documentfragment handled object.
i solved using can.view.render("leads/popup", viewoptions)
, returns me string rendered html.
Comments
Post a Comment