diff --git a/src/sunstone/public/app/tabs/vms-tab/datatable.js b/src/sunstone/public/app/tabs/vms-tab/datatable.js index 52f0bdb736..c8d9347869 100644 --- a/src/sunstone/public/app/tabs/vms-tab/datatable.js +++ b/src/sunstone/public/app/tabs/vms-tab/datatable.js @@ -128,6 +128,8 @@ define(function(require) { } function _initialize(opts) { + var that = this; + TabDataTable.prototype.initialize.call(this, opts); $('#' + this.dataTableId).on("click", '.vnc', function() { @@ -155,5 +157,24 @@ define(function(require) { return false; }); + + $('#' + this.dataTableId).on("change", 'tbody input.check_item', function() { + if ($(this).is(":checked")){ + StateActions.enableStateActions($(this).attr("state"), $(this).attr("lcm_state")); + } else { + // First disable all actions + StateActions.disableAllStateActions(); + + // Enable actions available to any of the selected VMs + var nodes = $('tr', that.dataTable); //visible nodes only + $.each($('input.check_item:checked', nodes), function(){ + StateActions.enableStateActions($(this).attr("state"), $(this).attr("lcm_state")); + }); + + } + + return true; + }); + } }); diff --git a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js index cdfaa96339..3c79d81fe6 100644 --- a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js +++ b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js @@ -63,9 +63,12 @@ define(function(require) { } return [ - '', + '', element.ID, element.UNAME, element.GNAME, diff --git a/src/sunstone/public/app/utils/tab-datatable.js b/src/sunstone/public/app/utils/tab-datatable.js index c22d43d4d0..b2319dab59 100644 --- a/src/sunstone/public/app/utils/tab-datatable.js +++ b/src/sunstone/public/app/utils/tab-datatable.js @@ -284,10 +284,10 @@ define(function(require) { this.dataTable.on("change", '.check_all', function() { var table = $(this).closest('.dataTables_wrapper'); if ($(this).is(":checked")) { //check all - $('tbody input.check_item', table).prop('checked', true); + $('tbody input.check_item', table).prop('checked', true).change(); $('td', table).addClass('markrowchecked'); } else { //uncheck all - $('tbody input.check_item', table).prop('checked', false); + $('tbody input.check_item', table).prop('checked', false).change(); $('td', table).removeClass('markrowchecked'); };