From 4f2937291949ae9b3f50813da6966d52f2f6a05d Mon Sep 17 00:00:00 2001 From: xq2005 Date: Sun, 25 Jul 2010 07:41:49 +0000 Subject: [PATCH] modified by xu qing for delete tab and select all git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6850 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/nodes/nodes.js | 20 +++++++++++++++++--- xCAT-UI/js/ui.js | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index d3fa07062..65e5354df 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -203,6 +203,7 @@ function loadNodes(data) { // Add column for check box, node, ping, and power sorted.unshift('', 'node', 'ping', 'power'); + sorted[0] = ''; // Create a datatable var dTable = new DataTable('nodesDataTable'); @@ -1627,8 +1628,14 @@ function deleteNode(tgtNodes) { 'color' : '#BDBDBD' }); }); + + var cancelBtn = createButton('Cancel'); + cancelBtn.bind('click', function(){ + myTab.remove($(this).parent().parent().attr('id')); + }); deleteForm.append(deleteBtn); + deleteForm.append(cancelBtn); myTab.add(newTabId, 'Delete', deleteForm); myTab.select(newTabId); @@ -2148,9 +2155,6 @@ function setGroupsCookies(data) { * @return Row element */ function getNodeRow(tgtNode, rows) { - // Get nodes datatable - var dTable = getNodesDataTable(); - // Find the row for ( var i in rows) { // Get all columns within the row @@ -2181,6 +2185,10 @@ function getNodesChecked() { var nodes = $('#nodesDataTable input[type=checkbox]:checked'); for ( var i = 0; i < nodes.length; i++) { tgtNodes += nodes.eq(i).attr('name'); + + if ("" == tgtNodes){ + continue; + } // Add a comma in front of each node if (i < nodes.length - 1) { @@ -2189,4 +2197,10 @@ function getNodesChecked() { } return tgtNodes; +} + +function selectAllCheckbox(event, obj){ + var status = obj.attr('checked'); + $('#nodesDataTable :checkbox').attr('checked', status); + event.stopPropagation(); } \ No newline at end of file diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index d3c3622dd..9a413baa3 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -104,6 +104,10 @@ Tab.prototype.select = function(id) { */ Tab.prototype.remove = function(id) { // To be continued + var selectorStr = 'a[href="\#' + id + '"]'; + var selectTab = $(selectorStr, this.tab).parent(); + var index = ($('li', this.tab).index(selectTab)); + this.tab.tabs("remove", index); }; /**