Permalink
Browse files

update README, add selected accessor

  • Loading branch information...
sgruhier committed Dec 22, 2010
1 parent b098a3a commit b673600cdf9fba6e85dc417fa29662a73f13d4ef
Showing with 14 additions and 2 deletions.
  1. +3 −0 README.rdoc
  2. +11 −2 src/jquery.ui.addresspicker.js
View
@@ -1,6 +1,9 @@
= jquery-addresspicker
jQuery UI widget to select an address.
+This widget has been develop for a specific need but feel free to use it or fork the repository
+
+= Features
- Autocompletion made by jquery-autcomplete widgets and filled by google maps V3 geocoding suggests
- Instant autocomplete suggestion on a map
@@ -45,14 +45,19 @@ $.widget( "ui.addresspicker", {
this._updatePosition(this.gmarker.getPosition());
},
+ selected: function() {
+ return this.selectedResult;
+ },
+
_create: function() {
if (!this._isGoogleMapLoaded()) {
$.error('Google map V3 script no loaded, add <script src="http://maps.google.com/maps/api/js?sensor=false"></script>')
}
this.geocoder = new google.maps.Geocoder();
this.element.autocomplete({
source: $.proxy(this._geocode, this),
- focus: $.proxy(this._selectAddress, this)
+ focus: $.proxy(this._focusAddress, this),
+ select: $.proxy(this._selectAddress, this)
});
this.lat = $(this.options.elements.lat);
@@ -123,7 +128,7 @@ $.widget( "ui.addresspicker", {
return false;
},
- _selectAddress: function(event, ui) {
+ _focusAddress: function(event, ui) {
var address = ui.item;
this.gmarker.setPosition(address.geometry.location);
this.gmarker.setVisible(true);
@@ -138,6 +143,10 @@ $.widget( "ui.addresspicker", {
}
},
+ _selectAddress: function(event, ui) {
+ this.selectedResult = ui.item;
+ },
+
_setOption: function( key, value ) {
$.Widget.prototype._setOption.apply( this, arguments );
},

0 comments on commit b673600

Please sign in to comment.