Calling a method in the managed bean upon editing a row of dataTable with p:cellEditor

Components, Ajax Framework, Utilities and More.
Post Reply
nm35
Posts: 1
Joined: 01 Dec 2017, 11:50

18 Jan 2018, 22:23

Hi,

I have a question. I have a dataTable with cellEditor and ajax that works fine. But I want that when the user clicks on the pencil icon (in order to open the row for editing), at this point I want to authenticate the user. In a method in the backing bean I can easily put Java code for programmatic security by invoking the authenticate method of HttpServletRequest. So how can I trigger a call to a method in the backing bean when the user clicks on the pencil icon? Please note that currently after the user is done editing the row, he clicks the tick icon and only then ajax is calling a method in the backing bean (to actually do the update in the database). I want this behavior to remain as is, but I want to authenticate the user before the user even enters the row. Can I put a p:ajax element right below the p:cellEditor element? If yes, then what should I put in it?

My cellEditor looks something like:

<p:cellEditor>
<f:facet name="output">
<h:outputText id="out" value="#{dataTableRowVariable.field1}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{dataTableRowVariable.field1}">
<p:ajax update="out" listener="#{myManagedBean.updateRowMethod}"/>
</h:inputText>
</f:facet>
</p:cellEditor>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 20 guests