mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
Feature #3471: Deleted elements from tables can now be deselected
This commit is contained in:
1 parent
c4577d085a
commit
1a3f4f5c2a
1 file changed
+17
@@ -7329,14 +7329,31 @@ function setupResourceTableSelect(section, context_id, options) {
|
||||
$(section).on("click", '#selected_ids_row_'+context_id+' span.fa.fa-times', function() {
|
||||
var row_id = $(this).parent("span").attr('row_id');
|
||||
|
||||
var found = false;
|
||||
|
||||
// TODO: improve preformance, linear search
|
||||
$.each(dataTable_select.fnGetData(), function(index, row){
|
||||
if(row[options.id_index] == row_id){
|
||||
found = true;
|
||||
row_click(dataTable_select.fnGetNodes(index), row);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found){
|
||||
var ids = $('#selected_ids_row_'+context_id, section).data("ids");
|
||||
delete ids[row_id];
|
||||
$('#selected_ids_row_'+context_id+' span[row_id="'+row_id+'"]', section).remove();
|
||||
|
||||
if ($.isEmptyObject(ids)){
|
||||
$('#selected_resource_multiple_'+context_id, section).hide();
|
||||
$('#select_resource_multiple_'+context_id, section).show();
|
||||
} else {
|
||||
$('#selected_resource_multiple_'+context_id, section).show();
|
||||
$('#select_resource_multiple_'+context_id, section).hide();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
|
||||
Reference in new issue
Block a user