I'm trying to accept an editRow event on a Primefaces TreeTable by pressing the ENTER key. But at the time of doing so, <p:commandButton/>
catches the event.
I tried in an <h:outputScript/>
jQuery:
$('tmt-library-tree').keypress(function(event) {
if(event.which == '13') {
event.preventDefault();
}
});
But it affects the entire TreeTable. I also tried selectors in the form of:
$("#screens\\:form\\:libraryGroupTreeTable\\:addGlobal").keypress(function(event) {
if(event.which == '13') {
event.preventDefault();
}
});
Taken from the Inspect window in Chrome Developer Tools and making sure it exists.
This is the Primefaces TreeTable
<p:treeTable id="libraryGroupTreeTable" styleClass="library-tree"
var="dummy" nodeVar="hltsOrHltsfOrLg" value="#{libraryTree}" emptyMessage=""
selectionMode="single" editable="#{editable}" scrollable="true">
and added an <p:ajax>
to handle rowEdit
<p:ajax event="rowEdit" listener="#{libraryTree.onRowEdit}" onstart="vres.onAjax(cfg, '#{libraryTree.gid}');" update="libraryGroupTreeTable"/>
Finally, here's my <p:outputPanel>
<p:outputPanel id="namePanel" style="display: inline-flex;">
<span class="tree-node-icons #{hltsOrHltsfOrLg.css}"/>
<div style="margin-top: 3px;">
<p:cellEditor>
<f:facet name="input"><p:inputText value="#{hltsOrHltsfOrLg.name}"/></f:facet>
<f:facet name="output"><h:outputText value="#{hltsOrHltsfOrLg.name}"/></f:facet>
</p:cellEditor>
</div>
</p:outputPanel>
I need the ENTER Key to do what the
<p: ajax/>
tag is doing at the moment of editing the cell.
Thanks in advance!