mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-22 14:54:38 +08:00
Merge pull request #2392 from mlorb/ml-sci-4313
Add empty option in dropdown selector [SCI-4313]
This commit is contained in:
commit
c1aa269afc
3 changed files with 13 additions and 1 deletions
|
@ -33,6 +33,7 @@ var ListColumnHelper = (function() {
|
|||
singleSelect: true,
|
||||
selectAppearance: 'simple',
|
||||
closeOnSelect: true,
|
||||
emptyOptionAjax: true,
|
||||
onChange: function() {
|
||||
var values = dropdownSelector.getValues('#' + select);
|
||||
$hiddenField.val(values);
|
||||
|
|
|
@ -34,6 +34,7 @@ var StatusColumnHelper = (function() {
|
|||
singleSelect: true,
|
||||
selectAppearance: 'simple',
|
||||
closeOnSelect: true,
|
||||
emptyOptionAjax: true,
|
||||
onChange: () => {
|
||||
var values = dropdownSelector.getValues('#' + select);
|
||||
$hiddenField.val(values);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
selectAppearance: string, // 'tag' or 'simple'. Default 'tag'
|
||||
closeOnSelect: boolean, // Close dropdown after select
|
||||
disableSearch: boolean, // Disable search
|
||||
emptyOptionAjax: boolean, // Add empty option for ajax request
|
||||
}
|
||||
|
||||
|
||||
|
@ -730,7 +731,16 @@ var dropdownSelector = (function() {
|
|||
ajaxParams = customParams ? customParams(defaultParams) : defaultParams;
|
||||
|
||||
$.get(selector.data('ajax-url'), ajaxParams, (data) => {
|
||||
loadData(selector, container, data);
|
||||
var optionsAjax = data;
|
||||
if (selector.data('config').emptyOptionAjax) {
|
||||
optionsAjax = [{
|
||||
label: '',
|
||||
value: '',
|
||||
group: null,
|
||||
params: {}
|
||||
}].concat(data);
|
||||
}
|
||||
loadData(selector, container, optionsAjax);
|
||||
PerfectSb().update_all();
|
||||
});
|
||||
// For local options we convert options element from select to correct array
|
||||
|
|
Loading…
Reference in a new issue