mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-04 05:12:30 +00:00 
			
		
		
		
	Fix getNodeAttr() to handle case where multiple columns contain the attribute name.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6968 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -554,11 +554,11 @@ function loadNode(e) {
 | 
			
		||||
	if (!e) {
 | 
			
		||||
		e = window.event;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	// Get node that was clicked
 | 
			
		||||
	var node = (e.target) ? e.target.id : e.srcElement.id;
 | 
			
		||||
	var mgt = getNodeAttr(node, 'mgt');
 | 
			
		||||
	
 | 
			
		||||
		
 | 
			
		||||
	// Create an instance of the plugin
 | 
			
		||||
	var plugin;
 | 
			
		||||
	switch(mgt) {
 | 
			
		||||
@@ -1138,14 +1138,30 @@ function getNodeAttr(node, attrName) {
 | 
			
		||||
	var row = $('[id=' + node + ']').parent().parent();
 | 
			
		||||
 | 
			
		||||
	// Search for the column containing the attribute
 | 
			
		||||
	var attrCol = row.parent().parent().find('th:contains("' + attrName + '")');
 | 
			
		||||
	// Get the attribute column index
 | 
			
		||||
	var attrIndex = attrCol.index();
 | 
			
		||||
	var attrCol;
 | 
			
		||||
	var cols = row.parent().parent().find('th:contains("' + attrName + '")');
 | 
			
		||||
	// Loop through each column
 | 
			
		||||
	for (var i in cols) {
 | 
			
		||||
		// Find column that matches the attribute
 | 
			
		||||
		if (cols.eq(i).html() == attrName) {
 | 
			
		||||
			attrCol = cols.eq(i);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	// If the column containing the attribute is found 
 | 
			
		||||
	if (attrCol) {
 | 
			
		||||
		// Get the attribute column index
 | 
			
		||||
		var attrIndex = attrCol.index();
 | 
			
		||||
 | 
			
		||||
	// Get the attribute for the given node
 | 
			
		||||
	var attr = row.find('td:eq(' + attrIndex + ')');
 | 
			
		||||
		// Get the attribute for the given node
 | 
			
		||||
		var attr = row.find('td:eq(' + attrIndex + ')');
 | 
			
		||||
 | 
			
		||||
	return attr.text();
 | 
			
		||||
		return attr.text();
 | 
			
		||||
	} else {
 | 
			
		||||
		return '';
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user