]
Nick Belaevski updated RF-5842:
-------------------------------
Fix Version/s: Future
a4j:support doesn't call input "onchange" handler
during changing selection of tree nodes.
------------------------------------------------------------------------------------------
Key: RF-5842
URL:
https://jira.jboss.org/jira/browse/RF-5842
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.3.1
Environment: IE6, IE7, FF 3.1.3, Safari 3.1, Opera 9.62
Reporter: Mikhail Vitenkov
Assignee: Nick Belaevski
Fix For: Future
#1. Use following page code:
<a4j:form id="form" eventsQueue="queue">
<rich:tree nodeSelectListener="#{custom.processSelection}"
ajaxSubmitSelection="true" switchType="ajax"
value="#{custom.treeNode}" var="item"
ajaxKeys="#{null}"
reRender="theOtherForm,currentNodeText" eventsQueue="queue">
</rich:tree>
<h:outputText escape="false"
value="Selected Node: #{custom.nodeTitle}"
id="currentNodeText" />
</a4j:form>
<a4j:form id="theOtherForm">
<h:inputText id="myInput1"
rendered="#{!custom.secondNodeSelected}"
value="#{custom.nodeTitle}">
<a4j:support event="onchange" reRender="form"
eventsQueue="queue" />
</h:inputText>
<h:inputText id="myInput2"
rendered="#{custom.secondNodeSelected}"
value="#{custom.nodeTitle}">
<a4j:support event="onchange" reRender="form"
eventsQueue="queue" />
</h:inputText>
<a4j:htmlCommandLink reRender="form" eventsQueue="queue">
<a4j:outputPanel>
<h:outputText value="click me" />
</a4j:outputPanel>
</a4j:htmlCommandLink>
</a4j:form>
#2. Java bean code:
import org.richfaces.component.html.HtmlTree;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeNodeImpl;
public class Custom {
private TreeNode currentNode;
private TreeNodeImpl firstNode;
private String nodeTitle;
private TreeNode rootNode;
private TreeNodeImpl secondNode;
public String getNodeTitle() {
if (currentNode != null) {
return (String) currentNode.getData();
} else {
return "unknown";
}
}
public TreeNode getTreeNode() {
if (rootNode == null) {
createTree();
}
return rootNode;
}
public boolean isSecondNodeSelected() {
return currentNode == secondNode;
}
public void processSelection(final NodeSelectedEvent event) {
final HtmlTree tree = (HtmlTree) event.getComponent();
nodeTitle = (String) tree.getRowData();
currentNode = tree.getModelTreeNode(tree.getRowKey());
}
public void setNodeTitle(final String title) {
if (currentNode != null) {
currentNode.setData(title);
}
}
private void createTree() {
int idx = 0;
rootNode = new TreeNodeImpl();
firstNode = new TreeNodeImpl();
firstNode.setData("Node 1");
rootNode.addChild(new Integer(idx++), firstNode);
secondNode = new TreeNodeImpl();
secondNode.setData("Node 2");
rootNode.addChild(new Integer(idx++), secondNode);
}
}
#3. Navigate to the page.
#4. Click on the "Node 1" tree node.
#5. Change input from "Node 1" to "Node 111" and select "Node
2" tree node.
#6. Verify 1st tree node title.
Actual behavior:
It's still "Node 1".
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: