diff --git a/riot/maMap.riot b/riot/maMap.riot index 0905410..c96a409 100644 --- a/riot/maMap.riot +++ b/riot/maMap.riot @@ -23,7 +23,7 @@ onUpdated() { if (this.props.records) { this.removeMarks(); - this.afficheMarks(this.getLoc(this.props.records)); + this.afficheMarks(this.props.records); this.onMoveEnd(); } }, @@ -34,9 +34,12 @@ }); }, - afficheMarks(loc) { - loc.forEach((coord) => { - var marker = L.marker([coord[0], coord[1]]).addTo(map); + afficheMarks(records) { + records.forEach((item) => { + var marker = L.marker([item.fields.g_olocalisation_des_formations[0], item.fields.g_olocalisation_des_formations[1]]).addTo(map); + marker.on('click', () => { + this.props.afficherModal(item) + }); markers.push(marker); }); }, @@ -54,14 +57,6 @@ }, - getLoc(records) { - let loc = []; - records.forEach((formation) => { - loc.push(formation.fields.g_olocalisation_des_formations); - }); - return loc; - }, - // méthode pour gérer l'événement "moveend" onMoveEnd() { let visibleMarkers = this.getVisibleMarkers(); diff --git a/riot/tableuFormation.riot b/riot/tableuFormation.riot index f6e82da..19f1cdc 100644 --- a/riot/tableuFormation.riot +++ b/riot/tableuFormation.riot @@ -1,6 +1,6 @@
- +