NIFI-6290:

- Ensuring the first allowable value is selected.
This commit is contained in:
Matt Gilman 2019-08-30 10:44:19 -04:00 committed by Scott Aslan
parent f318a8c685
commit c6e500dfa4
2 changed files with 13 additions and 17 deletions

View File

@ -135,7 +135,6 @@
// get the combo
var combo = $(this);
var firstOption = null;
// clear any current contents, remote events, and store options
combo.empty().unbind().data('options', options);
@ -187,10 +186,6 @@
// process the options
$.each(comboConfigOptions.options, function (i, option) {
if (firstOption === null) {
firstOption = option;
}
var optionText = $('<span class="combo-option-text"></span>').attr('title', option.text).text(option.text);
var optionValue = $('<span class="hidden"></span>').text(option.value);
@ -282,6 +277,12 @@
// add the drop down arrow
$('<div class="combo-arrow fa fa-chevron-down"></div>').appendTo(combo);
// get the first option
var firstOption = null;
if (options.options.length > 0) {
firstOption = options.options[0];
}
// set the selection
if (isDefinedAndNotNull(options.selectedOption)) {
selectOption(combo, options.selectedOption.text, options.selectedOption.value);

View File

@ -372,20 +372,15 @@
}
};
// initialize the parameter context combo
var combo = $('#process-group-parameter-context-combo').combo('destroy').combo(comboOptions);
// populate the parameter context
if (processGroupResult.permissions.canRead) {
var parameterContextId = null;
if ($.isEmptyObject(processGroupResult.component.parameterContext) === false) {
parameterContextId = processGroupResult.component.parameterContext.id;
}
$('#process-group-parameter-context-combo').combo('setSelectedOption', {
value: parameterContextId
});
if (processGroupResult.permissions.canRead && $.isEmptyObject(processGroupResult.component.parameterContext) === false) {
comboOptions.selectedOption = {
value: processGroupResult.component.parameterContext.id
};
}
// initialize the parameter context combo
$('#process-group-parameter-context-combo').combo('destroy').combo(comboOptions);
}).fail(nfErrorHandler.handleAjaxError);
};