1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

B #4697: Unselect row when previously selected (#4756)

This commit is contained in:
Sergio Betanzos 2020-05-18 18:40:38 +02:00 committed by GitHub
parent 2d4815483d
commit 008a459c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View File

@ -142,6 +142,13 @@ define(function(require) {
$('#NETWORK_UNAME', context).val(aData[options.uname_index]);
$('#NETWORK_UID', context).val("");
}
},
'unselect_callback': function() {
// reset values
that.secgroupsTable.selectResourceTableSelect({ ids: [] });
$.each(['NETWORK_ID', 'NETWORK', 'NETWORK_UNAME', 'NETWORK_UID'], function() {
$('#'+this, context).val("");
})
}
}
});

View File

@ -971,28 +971,28 @@ define(function(require) {
} else {
$('#' + that.dataTableId + ' tbody', section).delegate("tr", "click", function(e) {
that.dataTable.unbind("draw");
var wasChecked = $("td.markrow", this).hasClass("markrow");
var aData = that.dataTable.fnGetData(this);
var check = aData != undefined && !wasChecked;
$("td.markrow", that.dataTable).removeClass('markrow');
$('tbody input.check_item', that.dataTable).prop('checked', false);
$("td", that.dataTable).removeClass('markrow');
$("td", this).toggleClass('markrow', check);
$('tbody input.check_item', that.dataTable).prop('checked', check);
if (aData != undefined){
$("td", this).addClass('markrow');
$('input.check_item', this).prop('checked', true);
$('#selected_resource_' + that.dataTableId, section).toggle(check);
$('#select_resource_' + that.dataTableId, section).toggle(!check);
$('#selected_resource_' + that.dataTableId, section).show();
$('#select_resource_' + that.dataTableId, section).hide();
$('#selected_resource_id_' + that.dataTableId, section)
.val(function() { return check ? aData[that.selectOptions.id_index] : "" }).trigger("change");
$('#selected_resource_name_' + that.dataTableId, section)
.text(function() { return check ? aData[that.selectOptions.name_index] : "" }).trigger("change");
$('#selected_resource_id_' + that.dataTableId, section).val(aData[that.selectOptions.id_index]).trigger("change");
$('#selected_resource_name_' + that.dataTableId, section).text(aData[that.selectOptions.name_index]).trigger("change");
$('#selected_resource_name_' + that.dataTableId, section).show();
that.selectOptions.select_callback(aData, that.selectOptions);
}
$('#selected_resource_name_' + that.dataTableId, section).toggle(check);
$('#selected_resource_id_' + that.dataTableId, section).removeData("pending_select");
var callback = check ? "select_callback" : "unselect_callback";
that.selectOptions[callback](aData, that.selectOptions);
return true;
});
}