pass indexes array to js function
This commit is contained in:
@@ -82,8 +82,8 @@ function mp_ljdp_map() {
|
||||
//mp_console_log($locations);
|
||||
|
||||
$filters = mp_get_filters($events);
|
||||
mp_console_log("php filters:");
|
||||
mp_console_log($filters);
|
||||
//mp_console_log("php filters:");
|
||||
//mp_console_log($filters);
|
||||
|
||||
$to_add = array(
|
||||
"locations" => $locations,
|
||||
|
||||
@@ -17,7 +17,7 @@ function mp_create_div(&$filters) {
|
||||
';
|
||||
foreach ($filter as $value) {
|
||||
$mp_map_div .= '
|
||||
<p onclick="mp_filter_selection({lat:43.563, lng:76.4325})">'.$value->_name.'</p>
|
||||
<p onclick="mp_filter_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
|
||||
';
|
||||
}
|
||||
$mp_map_div .= '
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function mp_filter_selection(coordinates) {
|
||||
function mp_filter_selection(indexes) {
|
||||
|
||||
/*
|
||||
* following variable are created by mp_add_to_script.php
|
||||
@@ -6,6 +6,6 @@ function mp_filter_selection(coordinates) {
|
||||
*
|
||||
*/
|
||||
|
||||
console.log(coordinates);
|
||||
console.log(indexes);
|
||||
// coordinates.setMap(map);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ function mp_init_map() {
|
||||
* - filters: { - pays : [ { - _name : "" } ] }
|
||||
* { [ { - villes : [] } ] }
|
||||
* { [ { - categories: [] } ] }
|
||||
* { [ { - indexes : [] } ] }
|
||||
* { [ { - mode : [] }, ...] }
|
||||
* { [ ] }
|
||||
* { }
|
||||
@@ -49,17 +50,17 @@ function mp_init_map() {
|
||||
let marker_cluster = draw_clusters(map, markers);
|
||||
|
||||
|
||||
//let toggle = true;
|
||||
// add listener to close infowindow at any click on map
|
||||
let toggle = true;
|
||||
map.addListener('click', function() {
|
||||
infowindow.close();
|
||||
console.log(toggle);
|
||||
//markers[index].setMap(null);
|
||||
if (toggle === true)
|
||||
marker_cluster.removeMarker(markers[25]);
|
||||
else
|
||||
marker_cluster.addMarker(markers[25]);
|
||||
toggle = (toggle === true)? false : true ;
|
||||
//console.log(toggle);
|
||||
////markers[index].setMap(null);
|
||||
//if (toggle === true)
|
||||
// marker_cluster.removeMarker(markers[25]);
|
||||
//else
|
||||
// marker_cluster.addMarker(markers[25]);
|
||||
//toggle = (toggle === true)? false : true ;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user