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

autocomplete not working #177

Closed
g-teley opened this issue Jun 8, 2013 · 4 comments
Closed

autocomplete not working #177

g-teley opened this issue Jun 8, 2013 · 4 comments
Labels

Comments

@g-teley
Copy link

g-teley commented Jun 8, 2013

jQuery Autocomplete with ajax loaded values works fine as long as you're using the physical keyboard. If I enter 2 characters through the virtual keyboard, I see these characters but no autocomplete list. If I enter the third character on the physical keyboard it shows the first list. So the physical entered data correctly appends to the virtual entered data. Tried to leave out the Ajax part and use some simple words as test, same behaviour. Checked IE, Firefox, Chrome: all the same. Also selecting a value from the autocomplete list through the mouse doesn't work.
Tested with:
<... load jQuery, virtual keyboard, CSS etc...>
$(document).ready(function() {
$(function() {
function log(message) {
$("

").text(message).prependTo("#log");
$("#log").scrollTop(0);
}
$('#sometext').keyboard({
usePreview: false,
position: {at: 'right bottom', of: '#log'}
}).autocomplete({
source: ['One', 'Two', 'Three', 'Musketiers'],
minLength: 1,
select: function(event, ui) {
if (ui.item) {
log("Selected: " + ui.item.label);
}
}
}).addAutocomplete();
});
});

It looks like the Mottie Virtual keyboard can't find the jQuery autocomplete. In the source (line 88 onwards) it says:

// set up after keyboard is visible
base.autocomplete_setup = function() {
// look for autocomplete
base.$autocomplete = base.$el.data('autocomplete');
base.hasAutocomplete = (typeof(base.$autocomplete) === 'undefined') ? false : (base.$autocomplete.options.disabled) ? false : true;

As it turns out, base.hasAutocomplete is false.

@Mottie
Copy link
Owner

Mottie commented Jul 25, 2013

I'll have to look into this issue when I get back from my sabbatical, but make sure you are using the latest version of jQuery UI.

@g-teley
Copy link
Author

g-teley commented Jul 28, 2013

Hi Rob,

I have the latest JQuery-UI version (now 1.10.3).
What I allready found is that the code for checking the JQuery-UI version
in the autocomplete source (jquery.keyboard.extension-autocomplete.js) at
line 42 onwards has some problems with the version 1.10+ so I've changed:
// jQuery UI versions 1.9+ are different
// base.autocomplete_new_version = parseFloat($.ui.version) >=
1.9;
to:
var version = /(\d+).?(\d+)?.?(\d+)?/.exec($.ui.version);
var major = parseInt(version[1]) || 0;
var minor = parseInt(version[2]) || 0;
var sub = parseInt(version[3]) || 0;
base.autocomplete_new_version = (major > 1) || ((major === 1)
&& (minor >= 9));
console.log('autocomplete_new_version ' + major + '.' + minor +
'.' + sub + ' = ' + base.autocomplete_new_version);

But this doesn't help fixing the mentioned problem.

Enjoy your sabbatical.

regards,
Guus

2013/7/26 Rob G notifications@github.com

I'll have to look into this issue when I get back from my sabbatical, but
make sure you are using the latest version of jQuery UI.


Reply to this email directly or view it on GitHubhttps://github.com//issues/177#issuecomment-21592745
.

Met vriendelijke groet,

Guus Teley EMITA CISA RI
Heythuysen

@Mottie
Copy link
Owner

Mottie commented Oct 3, 2013

Hi @g-teley!

It looks like, in addition to your change, that they moved the autocomplete data from .data('autocomplete') to .data('uiAutocomplete') (see line 65 & line 88)

I'll have it fixed in the next update.

Thanks for your patience!
Rob

@g-teley
Copy link
Author

g-teley commented Oct 4, 2013

Hi Rob,

That makes a big difference!
It seems to work perfectly now with this change.

Thank you very much.

Kind regards,
Guus

2013/10/3 Rob G notifications@github.com

Hi @g-teley https://github.com/g-teley!

It looks like, in addition to your change, that they moved the
autocomplete data from .data('autocomplete') to .data('uiAutocomplete')(see line
65https://github.com/Mottie/Keyboard/blob/master/js/jquery.keyboard.extension-autocomplete.js#L65& line
88https://github.com/Mottie/Keyboard/blob/master/js/jquery.keyboard.extension-autocomplete.js#L88
)

I'll have it fixed in the next update.

Thanks for your patience!
Rob


Reply to this email directly or view it on GitHubhttps://github.com//issues/177#issuecomment-25590750
.

Met vriendelijke groet,

Guus Teley EMITA CISA RI
Heythuysen

@Mottie Mottie closed this as completed in 535b347 Oct 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants