-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
On click, suggestions are removed before event bubbles to top #118
Comments
Hello, Just to mention, I still have that problem with v0.9 and it is somethink I really would like to work ;) |
@mcadam your best bet is to probably just watch this thread, I'll be sure to update it when I get around to fixing this. |
jsfiddle reproducing the problem: http://jsfiddle.net/dukehoops/gYUQL/ |
Remove suggestions from DOM only after the click event that originated from a suggestion has bubbled to the root.
$(document).ready(function(){
$('#search2').typeahead({
hint: true,
highlight: true
},
{
name: 'products',
displayKey: 'name',
source: function (query, process) {
return $.post("php/Products.php", { action:'sell-search',search_value: query}, function (data) {
process(JSON.parse(data));
});
},
templates: {
empty: [
'<div class="empty-message text-danger">',
'<h3>Няма намерена стока</h3>',
'</div>'
].join('\n'),
suggestion: Handlebars.compile(
'<div class="row">' +
'<div class="col-xs-8"><div>{{name}}</div><div class="small text-success">{{category}}</div></div>' +
'<div class="col-xs-3">{{price_retail}} <span class="x-small">лв/{{measure}}<span></div>'+
'<div class="col-xs-1"><button class="btn btn-sm btn-warning float-right products-info "><span class="glyphicon glyphicon-info-sign"></span></button></div>' +
'</div>')
}
});
});
$(document).on('click','.products-info', function(e){
e.stopPropagation();
console.log("Cliicked");
console.log('Inside link');
alert('test');
return false;
}); This is my code, I am trying to implement clickable suggestion ( by clickable I mean, when the user clicks the '.products-info' button of the suggestion a modal with info will be launched up, AND the drop down menu with the suggestions will NOT hide). I think that this is exactly the same problem with this on the issue. What it heppans now is: P.S. I am using typeahead.js 0.10.5. |
This makes it impossible to use event delegation as noted #104.
The text was updated successfully, but these errors were encountered: