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
ajax datasources: remove locally-cached 'option' HTML element during item unselection #6282
base: develop
Are you sure you want to change the base?
ajax datasources: remove locally-cached 'option' HTML element during item unselection #6282
Conversation
…ved after unselecting an AJAX-sourced item
…tem that the updated text from the remote datasource is applied to the <option> element
'No items should be selected' | ||
); | ||
|
||
var queryTerms = ['firstQuery', 'secondQuery', 'thirdQuery', 'fourthQuery']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a really smelly way to achieve multiple visits and actions on the select2
control. My JavaScript-fu isn't great, so there's almost certainly a better way to do this.
Moving this pull request into a 'draft' status; option groups (nested results) need to be handled too. |
From testing locally: option groups do not result in the creation of nested HTML elements in the DOM-cached data; a flattened set of As a result: I don't think that any special-case handling is required for option groups, and I'll put this pull request back into a 'ready for review' state. The testing methodology I used was to create a small Python script to generate dummy nested JSON data in the In combination with a basic test HTML page (loading JQuery and Select2 JS and CSS files) with a |
This pull request includes a
The following changes were made
<option>
elements from the DOM when an AJAX-sourced item is unselected.If this is related to an existing ticket, include a link to it as well.
May resolve #5391.
Based upon / may be combined with #6241.