Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addresspicker:selected not last fired #36

Open
kitkat14 opened this issue Sep 26, 2015 · 1 comment
Open

addresspicker:selected not last fired #36

kitkat14 opened this issue Sep 26, 2015 · 1 comment

Comments

@kitkat14
Copy link

I try to change the input value after someone clicked but selected is not the last event.
Check

 var fromAddressPicker = new AddressPicker(
    {   autocompleteService: {
            types: ['address'],
            componentRestrictions: { country: 'nl' }
        }
    });

$("#from-address").typeahead(null, {
  displayKey: 'description',
  source: fromAddressPicker.ttAdapter()
});

fromAddressPicker.bindDefaultTypeaheadEvent($('#from-address'));

$(fromAddressPicker).on('addresspicker:selected', function (event, result) {
    $("#from-address").val(result.nameForType('route'));
});

So you can see i just want the route in the input after clicking something. It works but if I go out of focus it changes back to the original result (complete address, formated address)

@MarcoWue
Copy link

MarcoWue commented Jun 1, 2017

Had the same issue. Solution is descibed here:

Instead of $("#from-address").val(result.nameForType('route')); use $('#from-address').typeahead('val', result.nameForType('route'));.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants