Commit 083219a9 authored by Simon Knox's avatar Simon Knox

cache selector

parent 9ddb0780
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
abilityName = $dropdown.data('ability-name'); abilityName = $dropdown.data('ability-name');
$loading = $block.find('.block-loading').fadeOut(); $loading = $block.find('.block-loading').fadeOut();
const fieldName = options.fieldName || $dropdown.data("field-name"); const fieldName = options.fieldName || $dropdown.data("field-name");
const inputField = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`);
if (Object.keys(options).includes('selected')) { if (Object.keys(options).includes('selected')) {
$dropdown.closest('.selectbox').find(`input[name='${fieldName}']`).val(options.selected); inputField.val(options.selected);
} }
updateWeight = function(selected) { updateWeight = function(selected) {
...@@ -68,14 +69,14 @@ ...@@ -68,14 +69,14 @@
if (options.handleClick) { if (options.handleClick) {
e.preventDefault(); e.preventDefault();
selected = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`).val(); selected = inputField.val();
options.handleClick(selected); options.handleClick(selected);
} else if ($(dropdown).is(".js-filter-submit")) { } else if ($(dropdown).is(".js-filter-submit")) {
return $(dropdown).parents('form').submit(); return $(dropdown).parents('form').submit();
} else if ($dropdown.is('.js-issuable-form-weight')) { } else if ($dropdown.is('.js-issuable-form-weight')) {
e.preventDefault(); e.preventDefault();
} else { } else {
selected = $dropdown.closest('.selectbox').find(`input[name='${fieldName}']`).val(); selected = inputField.val();
return updateWeight(selected); return updateWeight(selected);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment