mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°2847 - Tranform old itop datatable to jquery DataTable - Fix management of button "Add" step 2
This commit is contained in:
@@ -174,7 +174,6 @@ var oTable{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
|
|
||||||
{% if oUIBlock.GetOption("select_mode") is not empty %}
|
{% if oUIBlock.GetOption("select_mode") is not empty %}
|
||||||
{% if oUIBlock.GetOption("select_mode") != "single" %}
|
{% if oUIBlock.GetOption("select_mode") != "single" %}
|
||||||
console.warn('aa');
|
|
||||||
oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, type, indexes) {
|
oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, type, indexes) {
|
||||||
var aData = oTable{{ oUIBlock.GetId() }}.rows(indexes).data().toArray();
|
var aData = oTable{{ oUIBlock.GetId() }}.rows(indexes).data().toArray();
|
||||||
if( $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
if( $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
|
||||||
@@ -242,8 +241,32 @@ oTable{{ oUIBlock.GetId() }}.off('deselect').on('deselect', function (oEvent, dt
|
|||||||
});
|
});
|
||||||
{% else %}
|
{% else %}
|
||||||
oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, type, indexes) {
|
oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, type, indexes) {
|
||||||
|
var aData = oTable{{ oUIBlock.GetId() }}.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 (var i in aData) {
|
||||||
|
var iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) === -1) {
|
||||||
|
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.push(iItemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
$('#btn_ok_{{ oUIBlock.GetOption('sListId') }}').prop('disabled', false);
|
$('#btn_ok_{{ oUIBlock.GetOption('sListId') }}').prop('disabled', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
oTable{{ oUIBlock.GetId() }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
|
||||||
|
var aData = oTable{{ oUIBlock.GetId() }}.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 (var i in aData) {
|
||||||
|
var iItemId = aData[i].id;
|
||||||
|
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) > -1) {
|
||||||
|
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.splice(oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user