mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°1443: Handle disabled selectable rows in datatables when "All checking/unchecking"
This commit is contained in:
@@ -90,7 +90,7 @@ function sprintf(format, etc) {
|
||||
function checkAll(table, pager, value)
|
||||
{
|
||||
// Mark all the displayed items as check or unchecked depending on the value
|
||||
$(table).find(':checkbox[name^=selectObj]').prop('checked', value);
|
||||
$(table).find(':checkbox[name^=selectObj]:not([disabled])').prop('checked', value);
|
||||
// Set the 'selectionMode' for the future objects to load
|
||||
if (value)
|
||||
{
|
||||
@@ -103,6 +103,7 @@ function sprintf(format, etc) {
|
||||
$(pager).find(':input[name=selectionMode]').val(table.config.selectionMode);
|
||||
// Reset the list of saved selection...
|
||||
resetStoredSelection(pager);
|
||||
$(table).find(':checkbox[name^=selectObj]').trigger("change");
|
||||
updateCounter(table, pager);
|
||||
return true;
|
||||
}
|
||||
@@ -112,7 +113,7 @@ function sprintf(format, etc) {
|
||||
$(':input[name^=storedSelection]', pager).remove();
|
||||
}
|
||||
|
||||
function storeSelection(table, pager, id, value)
|
||||
function storeSelection(table, pager, id, value, disabled=false)
|
||||
{
|
||||
var valueToStore = value;
|
||||
if (table.config.selectionMode == 'negative')
|
||||
@@ -127,7 +128,7 @@ function sprintf(format, etc) {
|
||||
}
|
||||
if ($('#'+id, pager).length ==0)
|
||||
{
|
||||
$(pager).append($('<input type="hidden" id="'+id+'" name="storedSelection[]" value="'+id+'"></input>'));
|
||||
$(pager).append($('<input type="hidden" id="'+id+'" name="storedSelection[]" value="'+id+'"'+ (disabled ? ' disabled ' : '') +'/>'));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -254,33 +255,33 @@ function sprintf(format, etc) {
|
||||
|
||||
if (c.selectionMode == 'negative')
|
||||
{
|
||||
$(table).find(':checkbox[name^=selectObj]').prop('checked', true);;
|
||||
$(table).find(':checkbox[name^=selectObj]:not([disabled])').prop('checked', true);
|
||||
}
|
||||
|
||||
if (table.config.select_mode == 'multiple')
|
||||
{
|
||||
$(table).find(':checkbox[name^=selectObj]').each(function() {
|
||||
$(table).find(':checkbox[name^=selectObj]:not([disabled])').each(function() {
|
||||
var id = parseInt(this.value, 10);
|
||||
if ($('#'+id, table.config.container).length > 0)
|
||||
{
|
||||
if (c.selectionMode == 'positive')
|
||||
{
|
||||
$(this).prop('checked', true);;
|
||||
$(this).prop('checked', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).prop('checked', false);;
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(table).find(':checkbox[name^=selectObj]').change(function() {
|
||||
storeSelection(table, table.config.container, this.value, this.checked);
|
||||
});
|
||||
storeSelection(table, table.config.container, this.value, this.checked, this.disabled);
|
||||
}).trigger("change");
|
||||
}
|
||||
else if (table.config.select_mode == 'single')
|
||||
{
|
||||
$(table).find('input[name^=selectObject]:radio').each(function() {
|
||||
$(table).find('input[name^=selectObject]:radio:not([disabled])').each(function() {
|
||||
var id = parseInt(this.value, 10);
|
||||
if ($('#'+id, table.config.container).length > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user