I'm using Primefaces 2.2 RC2.
I have some trouble in using the attribute "onkeyup" in "inputText".
View:
Code: Select all
<p:layout style="width:1238px;height:770px;">
<p:layoutUnit position="left" width="250" scrollable="true">
<p:tree id="monitorModelTree" value="#{monitorModelEditor.root}" var="node"
nodeSelectListener="#{monitorModelEditor.onNodeSelect}"
nodeExpandListener="#{monitorModelEditor.onNodeExpand}"
nodeCollapseListener="#{monitorModelEditor.onNodeCollapse}"
selectionMode="single" update="editorLayout">
<p:treeNode>
<h:outputText value="#{node}" styleClass="cur"/>
</p:treeNode>
<p:treeNode type="monitorModel">
<h:graphicImage library="images" name="monitorModel.png" />
<h:outputText value=" #{node}" styleClass="cur" />
</p:treeNode>
...
</p:tree>
</p:layoutUnit>
<p:layoutUnit id="editorLayout" position="center">
<p:panel id="monitorModelDetailsPanel" header="Monitor Modell Details"
rendered="#{monitorModelEditor.monitorModelNodeSelected}">
<h:panelGrid columns="2">
<h:outputText value="Name:" />
<h:inputText id="monitorModelName" value="#{monitorModelEditor.currentModel.name}"
onchange="newMonitorModelName()" onkeyup="monitorModelName()"/>
<p:remoteCommand name="monitorModelName" update="monitorModelTree" />
<p:remoteCommand id="saveNewMonitorModelName" name="newMonitorModelName"
process="@this,monitorModelName"
actionListener="#{monitorModelEditor.newMonitorModelName}" />
</h:panelGrid>
</p:panel>
...
</p:layoutUnit>
</p:layout>
To change the name of the element there is a "h:inputText" ("id=monitorModelName") with the attributes "onchange" and "onkeyup". Therefore I'm using the remoteCommand... "onchange" triggers the remoteCommand "newMonitorModelName" to check the new name of the element (is it okay or not). "onkeyup" triggers the remoteCommand "monitorModelName" and update the tree on the left side, so that the name of the element will be shown.
The "onchange"-event works fine, but the "onkeyup"-event does not work. I'm getting always a NullPointerException:
Code: Select all
20.01.2011 15:09:21 org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet SpringDispatcherServlet threw exception
java.lang.NullPointerException
at org.primefaces.component.tree.Tree.processUpdates(Tree.java:315)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
at javax.faces.component.UIForm.processUpdates(UIForm.java:268)
Is there any work-around? What is wrong with my code?
Thanks a lot for your help...
With best wishes,
Roman