From e6c7aadb3bdedb07b0b64f965010a7d3a885be60 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 24 Aug 2011 03:37:12 +0000 Subject: [PATCH] use double click to start edit in nodes page, do not submit ajax request if the input content without modification git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10350 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/nodes/nodes.js | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index ff5712f5d..d85d1334a 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -457,30 +457,6 @@ function mkAddNodeLink() { return addNodeLink; } -/** - * Load subgroups - * - * @param data - * Data returned from HTTP request - * @return Nothing - */ -function loadSubgroups(data) { - var rsp = data.rsp; // Data returned - var group = data.msg; // Group name - - // Go through each subgroup - for (var i in rsp) { - // Do not put the same group in the subgroup - if (rsp[i] != group && $('#' + group).length) { - // Add subgroup inside group - $('#groups').jstree('create', $('#' + group), 'inside', { - 'attr': {'id': rsp[i] + 'Subgroup'}, - 'data': rsp[i]}, - '', true); - } - } -} - /** * Load nodes belonging to a given group * @@ -946,7 +922,13 @@ function loadNodes(data) { */ // Do not make 1st, 2nd, 3rd, 4th, 5th, or 6th column editable $('#' + nodesTableId + ' td:not(td:nth-child(1),td:nth-child(2),td:nth-child(3),td:nth-child(4),td:nth-child(5),td:nth-child(6))').editable( - function(value, settings) { + function(value, settings) { + //if users did not do changes, return the value directly + //jeditable save the old value in this.revert + if ($(this).attr('revert') == value){ + return value; + } + // Get column index var colPos = this.cellIndex; @@ -989,6 +971,7 @@ function loadNodes(data) { onblur : 'submit', // Clicking outside editable area submits changes type : 'textarea', placeholder: ' ', + event : "dblclick", //double click and edit height : '30px' // The height of the text area }); @@ -1283,6 +1266,11 @@ function addNodes2Table(data) { // Do not make 1st, 2nd, 3rd, 4th, 5th, or 6th column editable $('#' + nodesTableId + ' td:not(td:nth-child(1),td:nth-child(2),td:nth-child(3),td:nth-child(4),td:nth-child(5),td:nth-child(6))').editable( function(value, settings) { + //if users did not do changes, return the value directly + //jeditable save the old value in this.revert + if ($(this).attr('revert') == value){ + return value; + } // Get column index var colPos = this.cellIndex; @@ -1325,6 +1313,7 @@ function addNodes2Table(data) { onblur : 'submit', // Clicking outside editable area submits changes type : 'textarea', placeholder: ' ', + event : "dblclick", height : '30px' // The height of the text area });