mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 22:39:03 +02:00
N°3868 - "Error: Invalid filter parameter" on mass update
This commit is contained in:
@@ -74,3 +74,7 @@ $ibo-input--margin-x: 5px !default;
|
|||||||
margin-leftt: $ibo-input--margin-x;
|
margin-leftt: $ibo-input--margin-x;
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
background-color: $ibo-input--disabled--background-color;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,54 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
function checkAllDataTable(tableId, value, listId) {
|
function checkAllDataTable(tableId, value, listId) {
|
||||||
let tableSelector = $('#'+tableId);
|
let tableSelector = $('#'+tableId);
|
||||||
// Set the 'selectionMode' for the future objects to load
|
// Set the 'selectionMode' for the future objects to load
|
||||||
let selectionMode = 'positive';
|
let selectionMode = 'positive';
|
||||||
if (value) {
|
if (value) {
|
||||||
selectionMode = 'negative';
|
selectionMode = 'negative';
|
||||||
}
|
}
|
||||||
window['oSelectedItems' + listId] = [];
|
window['oSelectedItems'+listId] = [];
|
||||||
// Mark all the displayed items as check or unchecked depending on the value
|
// Mark all the displayed items as check or unchecked depending on the value
|
||||||
tableSelector.find(':checkbox[name^=selectObj]:not([disabled])').each(function () {
|
tableSelector.find(':checkbox[name^=selectObj]:not([disabled])').each(function () {
|
||||||
let currentCheckbox = $(this);
|
let currentCheckbox = $(this);
|
||||||
currentCheckbox.prop('checked', value);
|
currentCheckbox.prop('checked', value);
|
||||||
let currentLine = currentCheckbox.closest("tr");
|
let currentLine = currentCheckbox.closest("tr");
|
||||||
(value) ? currentLine.addClass("selected") : currentLine.removeClass("selected");
|
(value) ? currentLine.addClass("selected") : currentLine.removeClass("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
tableSelector.parent().parent().find(':input[name=selectionMode]').val(selectionMode);
|
tableSelector.parent().parent().find(':input[name=selectionMode]').val(selectionMode);
|
||||||
// Reset the list of saved selection...
|
// Reset the list of saved selection...
|
||||||
$(':input[name^=storedSelection]').remove();
|
$(':input[name^=storedSelection]').remove();
|
||||||
tableSelector.parent().find(':checkbox[name^=selectObj]').trigger("change");
|
tableSelector.parent().find(':checkbox[name^=selectObj]').trigger("change");
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
tableSelector.DataTable().rows().select();
|
tableSelector.DataTable().rows().select();
|
||||||
} else {
|
} else {
|
||||||
tableSelector.DataTable().rows({page: 'current'}).deselect();
|
tableSelector.DataTable().rows({page: 'current'}).deselect();
|
||||||
}
|
}
|
||||||
updateDataTableSelection(listId);
|
updateDataTableSelection(listId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDataTableSelection(listId) {
|
function updateDataTableSelection(listId) {
|
||||||
let selectionContainer = $('#'+listId+' [data-target="ibo-datatable--selection"]');
|
let selectionContainer = $('#'+listId+' [data-target="ibo-datatable--selection"]');
|
||||||
let selectionCount = $('#'+listId+' [name="selectionCount"]');
|
let selectionCount = $('#'+listId+' [name="selectionCount"]');
|
||||||
let selectionMode = $('#'+listId+' [name=selectionMode]').val();
|
let selectionMode = $('#'+listId+' [name=selectionMode]').val();
|
||||||
|
|
||||||
selectionContainer.html('');
|
selectionContainer.html('');
|
||||||
let currentSelection = window['oSelectedItems'+listId];
|
let currentSelection = window['oSelectedItems'+listId];
|
||||||
for(let i in currentSelection) {
|
for(let i in currentSelection) {
|
||||||
let value = currentSelection[i];
|
let value = currentSelection[i];
|
||||||
selectionContainer.append('<input type="hidden" name="storedSelection[]" value="' + value + '">');
|
selectionContainer.append('<input type="hidden" name="storedSelection[]" value="' + value + '">');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectionMode === 'negative') {
|
if (selectionMode === 'negative') {
|
||||||
let total = window['oTable'+listId].page.info()["recordsTotal"];
|
let total = $('#'+$aOptions.sListId).DataTable().page.info()["recordsTotal"];
|
||||||
selectionCount.val(total - currentSelection.length);
|
selectionCount.val(total-currentSelection.length);
|
||||||
} else {
|
} else {
|
||||||
selectionCount.val(currentSelection.length);
|
selectionCount.val(currentSelection.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionCount.trigger('change');
|
selectionCount.trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMultipleSelectionParams(listId)
|
function getMultipleSelectionParams(listId)
|
||||||
@@ -56,8 +61,7 @@ function getMultipleSelectionParams(listId)
|
|||||||
var oRes = {};
|
var oRes = {};
|
||||||
|
|
||||||
oRes.selectionMode = '';
|
oRes.selectionMode = '';
|
||||||
if ($('#'+listId+' [name=selectionMode]').length > 0)
|
if ($('#'+listId+' [name=selectionMode]').length > 0) {
|
||||||
{
|
|
||||||
oRes.selectionMode = $('#'+listId+' [name=selectionMode]').val();
|
oRes.selectionMode = $('#'+listId+' [name=selectionMode]').val();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,16 @@ $(function () {
|
|||||||
sListId: '',
|
sListId: '',
|
||||||
oColumns: {},
|
oColumns: {},
|
||||||
sSelectMode: '',
|
sSelectMode: '',
|
||||||
|
sSelectedItemsName: "",
|
||||||
sViewLink: 'true',
|
sViewLink: 'true',
|
||||||
iPageSize: -1,
|
iPageSize: -1,
|
||||||
oClassAliases: {},
|
oClassAliases: {},
|
||||||
sTableId : null,
|
sTableId: null,
|
||||||
oData: {},
|
oData: {},
|
||||||
sRenderUrl: 'index.php',
|
sRenderUrl: 'index.php',
|
||||||
oRenderParameters: {},
|
oRenderParameters: {},
|
||||||
oDefaultSettings: {},
|
oDefaultSettings: {},
|
||||||
oLabels: { moveup: 'Move Up', movedown: 'Move Down' }
|
oLabels: {moveup: 'Move Up', movedown: 'Move Down'}
|
||||||
},
|
},
|
||||||
|
|
||||||
// the constructor
|
// the constructor
|
||||||
@@ -80,12 +81,14 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var parentElt = $('#'+me.options.sListId).closest('.dataTables_wrapper').parent();
|
var parentElt = $('#'+me.options.sListId).closest('.dataTables_wrapper').parent();
|
||||||
|
var aOptions = $('#'+me.options.sListId).DataTable().context[0].oInit;
|
||||||
|
window['bSelectAllowed'+me.options.sListId] = false;
|
||||||
$('#'+me.options.sListId).DataTable().destroy(true);
|
$('#'+me.options.sListId).DataTable().destroy(true);
|
||||||
var sThead = "";
|
var sThead = "";
|
||||||
if (me.options.sSelectMode != "") {
|
if (me.options.sSelectMode != "") {
|
||||||
sThead += "<th></th>";
|
sThead += "<th></th>";
|
||||||
}
|
}
|
||||||
var aOptions = JSON.parse(data);
|
aOptions = $.extend(aOptions, JSON.parse(data));
|
||||||
$.each(aOptions['allColumns'], function (i, item) {
|
$.each(aOptions['allColumns'], function (i, item) {
|
||||||
$.each(item, function (j, champs) {
|
$.each(item, function (j, champs) {
|
||||||
if (champs.checked == 'true') {
|
if (champs.checked == 'true') {
|
||||||
@@ -93,14 +96,15 @@ $(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$.each(aOptions['columns'], function(i, item) {
|
$.each(aOptions['columns'], function (i, item) {
|
||||||
aOptions["columns"][i]["render"]["display"] = new Function ( "data, type, row" , aOptions["columns"][i]["render"]["display"]);
|
aOptions["columns"][i]["render"]["display"] = new Function("data, type, row", aOptions["columns"][i]["render"]["display"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
parentElt.append( "<table id=\""+me.options.sListId+"\" width=\"100%\" class=\"ibo-datatable\">" +
|
parentElt.append("<table id=\""+me.options.sListId+"\" width=\"100%\" class=\"ibo-datatable\">"+
|
||||||
"<thead><tr>"+sThead+"</tr></thead></table>" );
|
"<thead><tr>"+sThead+"</tr></thead></table>");
|
||||||
aOptions["lengthMenu"]= [[oParams.end, oParams.end*2, oParams.end*3, oParams.end*4, -1], [oParams.end, oParams.end*2, oParams.end*3, oParams.end*4, aOptions["lengthMenu"]]];
|
aOptions["lengthMenu"] = [[oParams.end, oParams.end * 2, oParams.end * 3, oParams.end * 4, -1], [oParams.end, oParams.end * 2, oParams.end * 3, oParams.end * 4, aOptions["lengthMenu"]]];
|
||||||
aOptions["ajax"]=eval(aOptions["ajax"]);
|
aOptions["ajax"] = eval(aOptions["ajax"]);
|
||||||
|
|
||||||
$('#'+me.options.sListId).DataTable(aOptions);
|
$('#'+me.options.sListId).DataTable(aOptions);
|
||||||
|
|
||||||
me.element.unblock();
|
me.element.unblock();
|
||||||
|
|||||||
11
js/utils.js
11
js/utils.js
@@ -281,8 +281,15 @@ function ToggleField(value, field_id) {
|
|||||||
$('#'+field_id+' :input').prop('disabled', false);
|
$('#'+field_id+' :input').prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
$('#'+field_id).prop('disabled', true);
|
$('#'+field_id).prop('disabled', true);
|
||||||
// In case the field is rendered as a div containing several inputs (e.g. RedundancySettings)
|
if ($('#'+field_id).hasClass('selectized')) {
|
||||||
$('#'+field_id+' :input').prop('disabled', true);
|
$('#'+field_id)[0].selectize.disable();
|
||||||
|
} else if ($('#'+field_id).parent().find('.ibo-input-select-autocomplete').length > 0) {
|
||||||
|
$('#'+field_id).parent().find('.ibo-input-select-autocomplete').prop('disabled', true);
|
||||||
|
$('#'+field_id).parent().find('.ibo-input-select--action-buttons').addClass('ibo-is-hidden');
|
||||||
|
} else {
|
||||||
|
// In case the field is rendered as a div containing several inputs (e.g. RedundancySettings)
|
||||||
|
$('#'+field_id+' :input').prop('disabled', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$('#'+field_id).trigger('update');
|
$('#'+field_id).trigger('update');
|
||||||
$('#'+field_id).trigger('validate');
|
$('#'+field_id).trigger('validate');
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
{% if oUIBlock.GetOption("select_mode") is not empty %}
|
{% if oUIBlock.GetOption("select_mode") is not empty %}
|
||||||
var oSelectedItems{{ oUIBlock.GetOption('sListId') }} = [];
|
var oSelectedItems{{ oUIBlock.GetOption('sListId') }} = [];
|
||||||
{% if oUIBlock.GetOption("sSelectedRows") is not empty %}
|
{% if oUIBlock.GetOption("sSelectedRows") is not empty %}
|
||||||
oSelectedItems{{ oUIBlock.GetOption('sListId') }} = {{ oUIBlock.GetOption('sSelectedRows')|raw }};
|
oSelectedItems{{ oUIBlock.GetOption('sListId') }} = {{ oUIBlock.GetOption('sSelectedRows')|raw }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
var bSelectAllowed{{ oUIBlock.GetId() }} = false;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ else
|
|||||||
maxHeight{{ sListIDForVarSuffix }} = maxHeight{{ sListIDForVarSuffix }} -50;
|
maxHeight{{ sListIDForVarSuffix }} = maxHeight{{ sListIDForVarSuffix }} -50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
||||||
language: {
|
language: {
|
||||||
processing: "{{ 'UI:Datatables:Language:Processing'|dict_s }}",
|
processing: "{{ 'UI:Datatables:Language:Processing'|dict_s }}",
|
||||||
@@ -91,7 +90,8 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
{
|
{
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1)
|
if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1)
|
||||||
{
|
{
|
||||||
$(oRow).select();
|
this.api().row($(oRow)).select();
|
||||||
|
// $(oRow).addClass('selected');
|
||||||
$(oRow).find('td:first-child input').prop('checked', true);
|
$(oRow).find('td:first-child input').prop('checked', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
{
|
{
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(oData.id) > -1)
|
if (oSelectedItems{{ sListId }}.indexOf(oData.id) > -1)
|
||||||
{
|
{
|
||||||
$(oRow).select();
|
this.api().row($(oRow)).select();
|
||||||
$(oRow).find('td:first-child input').prop('checked', true);
|
$(oRow).find('td:first-child input').prop('checked', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,12 +108,12 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
||||||
{
|
{
|
||||||
$(this).closest('.dataTables_wrapper').find('.checkAll')[0].checked = true;
|
$(this).closest('.dataTables_wrapper').find('.checkAll')[0].checked = true;
|
||||||
$(this).DataTable().rows({page: 'current'}).select();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
||||||
}
|
}
|
||||||
|
bSelectAllowed{{ oUIBlock.GetId() }} = true;
|
||||||
|
|
||||||
$("#{{ oUIBlock.GetId() }} a").on('click', function (e) {
|
$("#{{ oUIBlock.GetId() }} a").on('click', function (e) {
|
||||||
//disable select action when there is a link
|
//disable select action when there is a link
|
||||||
@@ -197,113 +197,133 @@ var oTable{{ sListIfForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
this.find('.ibo-dataTables--processing').remove();
|
this.find('.ibo-dataTables--processing').remove();
|
||||||
this.find('tbody').unblock();
|
this.find('tbody').unblock();
|
||||||
this.find('thead').unblock();
|
this.find('thead').unblock();
|
||||||
|
|
||||||
|
{% if oUIBlock.GetOption("select_mode") is not empty %}
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
console.warn(this.api().rows('.selected').data().length);
|
||||||
|
{% if oUIBlock.GetOption("select_mode") != "single" %}
|
||||||
|
this.api().on('select', function (oEvent, dt, type, indexes) {
|
||||||
|
if (bSelectAllowed{{ oUIBlock.GetId() }})
|
||||||
|
{
|
||||||
|
console.warn('select');
|
||||||
|
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
||||||
|
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
||||||
|
{
|
||||||
|
// Checking input
|
||||||
|
$('#{{ oUIBlock.GetId() }} tbody tr.selected td:first-child input').prop('checked', true);
|
||||||
|
// Saving values in temp array
|
||||||
|
for (let i in aData)
|
||||||
|
{
|
||||||
|
let iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
|
||||||
|
{
|
||||||
|
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Checking input
|
||||||
|
$('#{{ oUIBlock.GetId() }} tbody tr.selected td:first-child input').prop('checked', true);
|
||||||
|
// Saving values in temp array
|
||||||
|
for (let i in aData)
|
||||||
|
{
|
||||||
|
let iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
|
||||||
|
{
|
||||||
|
oSelectedItems{{ sListId }}.push(iItemId);
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.api().off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
|
||||||
|
if (bSelectAllowed{{ oUIBlock.GetId() }} )
|
||||||
|
{
|
||||||
|
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
||||||
|
console.warn('deselect');
|
||||||
|
// Checking input
|
||||||
|
$('#{{ oUIBlock.GetId() }} tbody tr:not(.selected) td:first-child input').prop('checked', false);
|
||||||
|
// Saving values in temp array
|
||||||
|
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
||||||
|
{
|
||||||
|
for (let i in aData)
|
||||||
|
{
|
||||||
|
let iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
|
||||||
|
{
|
||||||
|
oSelectedItems{{ sListId }}.push(iItemId);
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (let i in aData)
|
||||||
|
{
|
||||||
|
let iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
|
||||||
|
{
|
||||||
|
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
{% else %}
|
||||||
|
this.api().off('select').on('select', function (oEvent, dt, type, indexes) {
|
||||||
|
if (bSelectAllowed{{ oUIBlock.GetId() }} )
|
||||||
|
{
|
||||||
|
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
||||||
|
// Checking input
|
||||||
|
$('#{{ oUIBlock.GetId() }} tbody tr.selected td:first-child input').prop('checked', true);
|
||||||
|
// Saving values in temp array
|
||||||
|
for (let i in aData)
|
||||||
|
{
|
||||||
|
let iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
|
||||||
|
{
|
||||||
|
oSelectedItems{{ sListId }}.push(iItemId);
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.api().off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
|
||||||
|
if (bSelectAllowed{{ oUIBlock.GetId() }} )
|
||||||
|
{
|
||||||
|
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
||||||
|
|
||||||
|
// Checking input
|
||||||
|
$('#{{ oUIBlock.GetId() }} tr tbody tr:not(.selected) td:first-child input').prop('checked', false);
|
||||||
|
// Saving values in temp array
|
||||||
|
for (let i in aData)
|
||||||
|
{
|
||||||
|
let iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
|
||||||
|
{
|
||||||
|
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
|
||||||
|
updateDataTableSelection('{{ sListId }}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
oTable{{ sListIfForVarSuffix }}.select();
|
||||||
$('#{{ oUIBlock.GetId() }}').closest(".dataTables_scrollBody").css('max-height', maxHeight{{ sListIDForVarSuffix }}-100);
|
$('#{{ oUIBlock.GetId() }}').closest(".dataTables_scrollBody").css('max-height', maxHeight{{ sListIDForVarSuffix }}-100);
|
||||||
|
|
||||||
|
|
||||||
{% if oUIBlock.GetOption("select_mode") is not empty %}
|
|
||||||
{% if oUIBlock.GetOption("select_mode") != "single" %}
|
|
||||||
oTable{{ sListIfForVarSuffix }}.off('select').on('select', function (oEvent, dt, type, indexes) {
|
|
||||||
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
|
||||||
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
|
||||||
{
|
|
||||||
// Checking input
|
|
||||||
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
|
|
||||||
// Saving values in temp array
|
|
||||||
for (let i in aData)
|
|
||||||
{
|
|
||||||
let iItemId = aData[i].id;
|
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
|
|
||||||
{
|
|
||||||
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
|
|
||||||
updateDataTableSelection('{{ sListId }}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Checking input
|
|
||||||
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
|
|
||||||
// Saving values in temp array
|
|
||||||
for (let i in aData)
|
|
||||||
{
|
|
||||||
let iItemId = aData[i].id;
|
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
|
|
||||||
{
|
|
||||||
oSelectedItems{{ sListId }}.push(iItemId);
|
|
||||||
updateDataTableSelection('{{ sListId }}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
oTable{{ sListIfForVarSuffix }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
|
|
||||||
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
|
||||||
|
|
||||||
// Checking input
|
|
||||||
$('#{{ oUIBlock.GetId() }} tr[role="row"]:not(.selected) td:first-child input').prop('checked', false);
|
|
||||||
// Saving values in temp array
|
|
||||||
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
|
||||||
{
|
|
||||||
for (let i in aData)
|
|
||||||
{
|
|
||||||
let iItemId = aData[i].id;
|
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
|
|
||||||
{
|
|
||||||
oSelectedItems{{ sListId }}.push(iItemId);
|
|
||||||
updateDataTableSelection('{{ sListId }}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (let i in aData)
|
|
||||||
{
|
|
||||||
let iItemId = aData[i].id;
|
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
|
|
||||||
{
|
|
||||||
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
|
|
||||||
updateDataTableSelection('{{ sListId }}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
{% else %}
|
|
||||||
oTable{{ sListIfForVarSuffix }}.off('select').on('select', function (oEvent, dt, type, indexes) {
|
|
||||||
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
|
||||||
// Checking input
|
|
||||||
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
|
|
||||||
// Saving values in temp array
|
|
||||||
for (let i in aData)
|
|
||||||
{
|
|
||||||
let iItemId = aData[i].id;
|
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
|
|
||||||
{
|
|
||||||
oSelectedItems{{ sListId }}.push(iItemId);
|
|
||||||
updateDataTableSelection('{{ sListId }}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
oTable{{ sListIfForVarSuffix }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
|
|
||||||
let aData = oTable{{ sListIfForVarSuffix }}.rows(indexes).data().toArray();
|
|
||||||
|
|
||||||
// Checking input
|
|
||||||
$('#{{ oUIBlock.GetId() }} tr[role="row"]:not(.selected) td:first-child input').prop('checked', false);
|
|
||||||
// Saving values in temp array
|
|
||||||
for (let i in aData)
|
|
||||||
{
|
|
||||||
let iItemId = aData[i].id;
|
|
||||||
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
|
|
||||||
{
|
|
||||||
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
|
|
||||||
updateDataTableSelection('{{ sListId }}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if oUIBlock.GetOption('sCountSelector') is not empty %}
|
{% if oUIBlock.GetOption('sCountSelector') is not empty %}
|
||||||
$('#{{ sListId }} [name="selectionCount"]').bind('change', function () {
|
$('#{{ sListId }} [name="selectionCount"]').bind('change', function () {
|
||||||
@@ -312,8 +332,6 @@ $('#{{ sListId }} [name="selectionCount"]').bind('change', function () {
|
|||||||
});
|
});
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
$('#datatable_dlg_{{ oUIBlock.GetId() }}').dialog(
|
$('#datatable_dlg_{{ oUIBlock.GetId() }}').dialog(
|
||||||
{
|
{
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
@@ -334,6 +352,7 @@ $aOptions = {
|
|||||||
sListId: '{{ oUIBlock.GetId() }}',
|
sListId: '{{ oUIBlock.GetId() }}',
|
||||||
oColumns: {{ oUIBlock.GetResultColumnsAsJson()|raw }},
|
oColumns: {{ oUIBlock.GetResultColumnsAsJson()|raw }},
|
||||||
sSelectMode: "{{ oUIBlock.GetOption("select_mode") }}",
|
sSelectMode: "{{ oUIBlock.GetOption("select_mode") }}",
|
||||||
|
sSelectedItemsName: "oSelectedItems{{ sListId }}",
|
||||||
sViewLink: '{{ oUIBlock.GetOption("bViewLink") }}',
|
sViewLink: '{{ oUIBlock.GetOption("bViewLink") }}',
|
||||||
iPageSize: '{{ oUIBlock.GetOption("iPageSize") }}',
|
iPageSize: '{{ oUIBlock.GetOption("iPageSize") }}',
|
||||||
oClassAliases: JSON.parse('{{ oUIBlock.GetOption("oClassAliases") |raw }}'),
|
oClassAliases: JSON.parse('{{ oUIBlock.GetOption("oClassAliases") |raw }}'),
|
||||||
|
|||||||
Reference in New Issue
Block a user