Fix problem with item name dropdown selection #4883
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #4547
Description
This issue occurs when an ajax call to populate the item names in the dropdown options occurs while the dropdown has been opened. Selecting an option doesn't work because that option no longer exists, so nothing happens (so item selected in the field will be the first item from the list of new options).
To fix this I made two changes:
/inventory.json
) every time you click "Add Another Item". And an ajax call is made to fetch the inventory whenever the storage location changes. I'm assuming it's not needed to fetch the inventory so often. So I changed it to only fetch the inventory item names/quantities on storage location field change, then we store those dropdown options and reuse them whenever a new line item is added.This will make adding new line items more responsive, and with less jank (from the reduced number of ajax calls) (ie. the item name changing from "XL Diapers" to "XL Diapers (1353)").
Type of change
How Has This Been Tested?
Tested manually in Chrome on my local machine, using the reproduction steps provided here.
Testing has been tough. I see a similar issue to the one I'm having where the
input
event isn't being triggered by cuprite. In my case theselect2:select
event isn't being triggered for some reason.