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

allow user click item for adding it when autocomplete custom render return html not simple text #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

quaff
Copy link

@quaff quaff commented Mar 31, 2012

allow user click item for adding it when autocomplete custom render return html not simple text

for example,if json is not string array,but a tuple array:
[{"label":"label for value1","value":"value1"},{"label":"label for value2","value":"value2"}]

render : function(suggestion) {
if (typeof suggestion == 'string') {
return suggestion;
} else {
if (!suggestion.label)
return suggestion.value;
else
return '<div value="' + suggestion.value + '">'+ suggestion.label + '</div>';
}
}

allow user click item for adding it when autocomplete custom render return html not simple text

for example,if json is not string array,but a tuple array:
[{"label":"label for value1","value":"value1"},{"label":"label for value2","value":"value2"}]

render : function(suggestion) {
if (typeof suggestion == 'string') {
return suggestion;
} else {
if (!suggestion.label)
return suggestion.value;
else
return '<div value="' + suggestion.value + '">'+ suggestion.label + '</div>';
}
}
balupton added a commit to macropodhq/jquery-textext that referenced this pull request Jul 24, 2012
…batchev#28 - Suggestions aren't clickable when autocomplete is manually shown

Problem is that the click event does not fire for some reason, however
the mouseup event does. Likely browser lacking support, or the click
event is cancelled by a bubbling event. However, this fixes the issue.
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

Successfully merging this pull request may close these issues.

None yet

1 participant