3

I want to edit a multiline text in cells, so I have this code:

<p:dataTable ... editable="true" editMode="cell">
    <p:column ...>
         <p:cellEditor>
               <f:facet name="output"><h:outputText value="#{myBean.value}"/></f:facet>
               <f:facet name="input"><p:inputTextarea value="#{myBean.value}"/></f:facet>
          </p:cellEditor>
    </p:column>
</p:dataTable>

But I've faced the problem that I cannot insert new line because changes are sent to backend on enter press. Is it possible to send changes on ctrl+enter or add a small "ok" button?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Feedforward
  • 4,521
  • 4
  • 22
  • 34
  • If I understand well, you want to change the default keyboard touch to validate an edit on a row?. is it the case? – ziMtyth Sep 12 '17 at 09:48
  • What PF version? – Kukeltje Sep 12 '17 at 09:53
  • [Here](https://stackoverflow.com/questions/16919467/how-to-set-an-action-to-primefaces-keyboards-enter-button) it is mentionned `onkeypress="if (event.keyCode == 13) #{usersBean.login()};"` maybe it is related to your situation. – ziMtyth Sep 12 '17 at 09:58
  • I have searched further more about `event.keycode`, and I found this : [JSF2 Primefaces Enter key keycode=13 not working with commandButton](https://stackoverflow.com/questions/16919467/how-to-set-an-action-to-primefaces-keyboards-enter-button), read the answer. You may take a look at this too [How to prevent ENTER keypress to submit a web form?](https://stackoverflow.com/questions/585396/how-to-prevent-enter-keypress-to-submit-a-web-form) – ziMtyth Sep 12 '17 at 10:08
  • https://stackoverflow.com/a/28117166/1341535 – Vsevolod Golovanov Sep 16 '17 at 09:36

0 Answers0