Closed cgossy closed 9 years ago
I wonder if newKey is '' after that line var newKey = key.replace('autocomplete', '');
. In that case, I'd understand that newKey[0] would be undefined. That could be caused by an attribute named data-autocomplete
in the generated input tag.
Could you paste the generated input HTML ?
Also, if my assumption is wrong, could you break if (newKey.length == 0)
and figure what the key
value is in that case ? Thanks !
Hi
Here's the generated HTML . Yes you're right, I was also looking for data-autocomplete
but there is no attribute with this name in my HTML code: (I'm using jQuery v2.1.1)
<div class="col-sm-12 nopadding">
<input type="text" placeholder="Type here to search" name="sis_search" id="id_sis_search" data-widget-bootstrap="text" data-autocomplete-url="/autocomplete/SISSearchAutocomplete/" data-autocomplete-choice-selector="[data-value]" class="col-sm-9-min autocomplete autocomplete-light-text-widget" autocomplete="off">
</div>
the Key value is "autocomplete" (after the replacemtent it is an empty string "" ) and it seems to be the autcomplete javascript object (containing all attributes like input, xhrWait, url, .etc...), when I inspect the variable using Firebug
Ok, could you try with branch fix_337 ?
pip uninstall django-autocomplete-light
pip install -e git+https://github.com/yourlabs/django-autocomplete-light.git@fix_337#egg=autocomplete-light
Thanks !
Thanks for your fast reply Unfortunately this does not solve the problem First: the pach code in both javascript files is written in python :-)
e.g.
if (key.substr(0, 6) != 'widget' or key.length == 6) continue;
should be
if (key.substr(0, 6) != 'widget' || key.length == 6) continue;
beside that, the error (see first comment) remains in file text_widget.js
line 198 (this file is unchanged in your patched version)
I just pushed a new commit on that branch and I think it's better. Could you try again please ?
Ooops ! Thanks for your feedback, I've updated the branch. I'm not testing manually, I completely rely on travis functional and unit tests and your feedback due to time constraints ...
Of course, pull requests are always welcome and have chances to speed up the bugfix release process ;)
sorry I don't have the permission (company policy) to add sourcecode directly into github projects. otherwise I would have done it as pull request
yes, the error is gone. looks good to me
Ok, that's probably why you don't have your company name in your profile xD
Thanks for your feedback, issuing a release.
Thanks a lot for your time and effort !!
On Wed, Nov 19, 2014 at 1:34 PM, cgossy notifications@github.com wrote:
yes, the error is gone. looks good to me
— Reply to this email directly or view it on GitHub https://github.com/yourlabs/django-autocomplete-light/issues/337#issuecomment-63633313 .
http://yourlabs.org http://blog.yourlabs.org Customer is king - Le client est roi - El cliente es rey.
Released in 2.0.3, thanks again for your help
This is my form fielddefinition:
I'm adding the javascript object by myself in the template like this:
The problem is that the autocomplete js-object is returned in when getting the data attributes using
this.data()
in text_widget.jsOverriding the for loop fixes the problem:
What am I doing wrong here.