backoffice: adjust geojson data source selection for jquery 3.x (#68600)
This commit is contained in:
parent
ce5176890b
commit
34bf72a718
|
@ -313,11 +313,18 @@ $(function() {
|
|||
$('input[name="data_mode"][value="simple-list"]').prop('disabled', true);
|
||||
$('input[name="data_mode"][value="data-source"]').click()
|
||||
$('select[name="data_source$type"] option:not([data-type="geojson"])').hide();
|
||||
if ($('select[name="data_source$type"] option:selected:visible').length == 0) {
|
||||
$('select[name="data_source$type"] option:visible').first().prop('selected', true).trigger('change');
|
||||
if ($('select[name="data_source$type"] option:selected').css('display') != 'block') {
|
||||
// if current option is not visible (not a geojson source) select
|
||||
// first appropriate source.
|
||||
for (const option of $('select[name="data_source$type"] option')) {
|
||||
if ($(option).css('display') == 'block') {
|
||||
$(option).prop('selected', true).trigger('change');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($('select[name="data_source$type"] option:selected:visible').length == 0) {
|
||||
// stil empty, it means there are no geojson sources at all, display
|
||||
if ($('select[name="data_source$type"] option:selected').css('display') != 'block') {
|
||||
// still empty, it means there are no geojson sources at all, display
|
||||
// first option (which will be "None").
|
||||
$('select[name="data_source$type"] option').first().show().prop('selected', true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue