-
Notifications
You must be signed in to change notification settings - Fork 64
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
AutoCompleteSelectWidget doesn't respond when underlying <input hidden> value gets changed. #101
Comments
Nothing in my reply nor the mailing list thread implies building a JSON service to get this data. If you are setting the value manually you clearly already have a means of getting the data. Using the Original Comment By: Mark Lavin |
If you're just suggesting I build a JSON service to get the data and inject it manually, that's certainly the route to go, but I don't understand the use of using the 'select' method vs. just setting the fields directly. Original Comment By: leo-the-manic |
That isn't really related to what this ticket is about. Original Comment By: leo-the-manic |
Note that you can do programmatic selection on the client side with the Original Comment By: Mark Lavin |
After tinkering with jQueryUI's auto-complete I found that it only operates on text fields. In contrast, select2 must be activated on an field, so it makes sense for select2 to come with such a feature out of the box, whereas the same idea doesn't apply to jQueryUI's autocomplete. The link between the autocomplete text field and a hidden input is established by django-selectable, so if the feature in this ticket were to exist anywhere it would exist in this project. However I presume you believe this is out of the scope of your project so I won't re-open this ticket. Original Comment By: leo-the-manic |
Confusion with feature from django-select2. Original Comment By: Mark Lavin |
Oh, right. I'm a migrant from django-select2, where the underlying select2 widget did support this feature but the django-select2 package ended up breaking it. I haven't properly reset my brain, but you're right, this isn't relevant to this project. My apologies! Original Comment By: leo-the-manic |
The primary goal of this project is to be an easy bridge between the Django form system and the jQuery UI autocomplete. If this functionality doesn't exist in the jQuery UI code then it isn't likely to be included here. Original Comment By: Mark Lavin |
@mlavin The problem with no change action on hidden form change is quite easily solvable with following JavaScript: // Fix triggering chaining on hidden company field
$( "#id_company_0" ).on( "djselectableselect", function( event, ui ) {
$('#id_company_1').change();
} ); but I spend half of day searching for this solution. What about adding it to documentation? |
That seems like a reasonable inclusion to me. |
Given a field
foo = selectable.forms.AutoCompleteSelectField(...)
, doing$("#id_foo_1").val("3").trigger('change')
does not cause the text to update.This is something that select2 supports. If you go to their webpage and go to the "Loading Remote Data" section, open up a JS debugger console, and run code like
$("#e6").val('16010').trigger('change')
, you'll see the widget text updates appropriately and can even see it making the proper requests in the network tab. (I'm using Chrome but I assume Firefox has similar dev tools.)This doesn't seem like a problematic change so I am going to start working on a patch.
The text was updated successfully, but these errors were encountered: