Author: sergeyhalipov
Date: 2007-07-11 09:58:47 -0400 (Wed, 11 Jul 2007)
New Revision: 1596
Modified:
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
Log:
http://jira.jboss.com/jira/browse/RF-372
Modified:
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
---
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-07-11
12:00:11 UTC (rev 1595)
+++
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-07-11
13:58:47 UTC (rev 1596)
@@ -242,13 +242,9 @@
if (e && e.type == "mousedown" /* can be keydown */) {
if(Event.isLeftClick(e)) {
var src = Event.element(e);
- if(src.tagName && (
- src.tagName.toUpperCase() == 'INPUT' ||
- src.tagName.toUpperCase() == 'SELECT' ||
- src.tagName.toUpperCase() == 'OPTION' ||
- src.tagName.toUpperCase() == 'BUTTON' ||
- src.tagName.toUpperCase() == 'TEXTAREA'))
- return;
+ if(src.tagName &&
+ /^(input|select|option|button|textarea)$/i.test(src.tagName))
+ return;
Event.stop(e);
} else {
Modified:
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
---
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-07-11
12:00:11 UTC (rev 1595)
+++
branches/3.0.2/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-07-11
13:58:47 UTC (rev 1596)
@@ -57,21 +57,26 @@
var itemOnSelect = treeItem.getRichAttribute("onselected");
itemOnSelect = new Function('event', (itemOnSelect ? itemOnSelect :
"") + "; return true;");
+
+ var prevSelection = this.selectionManager.activeItem;
+ treeItem.toggleSelection(event);
var selectResult = itemOnSelect(event);
if (!selectResult) {
event["cancelSelection"] = true;
+ event["treeItem"] = prevSelection;
+ prevSelection.toggleSelection(event);
return ;
}
selectResult = this.onselect(event);
if (!selectResult) {
event["cancelSelection"] = true;
+ event["treeItem"] = prevSelection;
+ prevSelection.toggleSelection(event);
return ;
}
- treeItem.toggleSelection(event);
-
var attr = Richfaces.getNSAttribute("ajaxselectedlistener",
$(event.selectedNode + Tree.ID_DEVIDER + Tree.ID_ICON));
if (attr) {
this.onAjaxSelect(event);