Notes

Enter a Search string - e.g. an address, place name or landmark. The item has an onchange dynamic action that executes the following: $("#map_mymap").reportmap("gotoAddress",$v(this.triggeringElement));

When it is found, the map raises the addressFound event.

A dynamic action on the region then executes the following Actions:

  1. Execute JavaScript Code: this.data.map.setCenter({lat:this.data.lat,lng:this.data.lng}); this.data.map.setZoom(17);
  2. Set Value, on item P5_ADDRESS, to JavaScript Expression: this.data.result.formatted_address
  3. Set Value, on item P5_DSP_LAT_LNG, to JavaScript Expression: this.data.lat + " " + this.data.lng);

Alternatively, if you click any point on the map, the mapClick event fires and a dynamic action executes: //place the user pin at the point they clicked $("#map_mymap").reportmap("gotoPos",this.data.lat,this.data.lng); //execute a geocoder search $("#map_mymap").reportmap("getAddressByPos",this.data.lat,this.data.lng);

The maps "Draggable" option is set. This means the marker can be dragged to a new location; when this occurs, the markerDrag event fires and a dynamic action calls getAddressByPos again.

If the Region is selected, the search will bias the results to the selected region if multiple results are found.

If the Country is selected, the results will be restricted to the selected country.

When the Country is changed, a dynamic action performs two actions:

  1. Set Value - retrieves the lat,lng for the country into P5_LATLNG
  2. Javascript: $("#map_mymap").reportmap("option","restrictCountry",$v("P5_COUNTRY")); var ctr = $("#map_mymap").reportmap("parseLatLng",$v("P5_LATLNG")); $("#map_mymap").reportmap("instance").map.setCenter(ctr);
This demonstrates how to modify one of the plugin options at runtime, how to convert a string to a Google Maps LatLng object, and how to execute arbitrary Google Maps API calls.