Minor fixes

This commit is contained in:
fbsanchez 2020-05-25 18:18:38 +02:00
parent 7be305298a
commit 7bc9a96524
2 changed files with 16 additions and 2 deletions

View File

@ -798,6 +798,7 @@ function html_print_select_multiple_filtered(
// Left box.
$output .= '<div class="multi-select-container flex-column">';
$disable_filters = '';
// Filtering.
if (isset($sections['filters']) === true
@ -844,6 +845,7 @@ function html_print_select_multiple_filtered(
$output .= '</div>';
$output .= '</div>';
$disable_filters = "disableFilters('".$rid."')";
}
if (isset($sections['item-available-filter']) === true
@ -887,7 +889,7 @@ function html_print_select_multiple_filtered(
'fields' => $available,
'name' => 'available-select-'.$rid.'[]',
'selected' => '',
'script' => '',
'script' => $disable_filters,
'nothing' => '',
'nothing_value' => 0,
'return' => true,

View File

@ -79,6 +79,14 @@ function filterSelectedItems(txt, id, noneStr) {
keepSelectClean("selected-select-" + id, noneStr);
}
function disableFilters(id) {
$("#id-group-selected-select-" + id).prop("disabled", true);
$("#checkbox-id-group-recursion-selected-select-" + id).prop(
"disabled",
true
);
}
function reloadContent(id, url, options, side, noneStr) {
var current;
var opposite;
@ -110,7 +118,11 @@ function reloadContent(id, url, options, side, noneStr) {
// Cleanup previous content.
$("#" + current).empty();
for (var [value, label] of Object.entries(data)) {
let items = Object.entries(data).sort(function(a, b) {
return a[1] >= b[1];
});
for (var [value, label] of items) {
if (
$("#" + opposite + " option[value=" + value + "]").length == 0 &&
$("#tmp-" + current + " option[value=" + value + "]").length == 0