1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-18 02:50:09 +03:00

B : Unselect row when previously selected ()

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
src/sunstone/public/app
tabs/templates-tab/form-panels/create/wizard-tabs/network
utils

@ -142,6 +142,13 @@ define(function(require) {
$('#NETWORK_UNAME', context).val(aData[options.uname_index]); $('#NETWORK_UNAME', context).val(aData[options.uname_index]);
$('#NETWORK_UID', context).val(""); $('#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("");
})
} }
} }
}); });

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