Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces ajax Inplace save data

I have one Problem with the inplace Tag from JSF Primefaces

Here is a code snippet

<h:form >
 <p:inplace id="ajaxInplace" editor="true">  
   <p:inputText value="#{productService.instance.productName}"required="true"     label="text"/>     
 </p:inplace>
</h:form>

after the I press the confirmation button of the ajax inplace i want to store the changed data to my database. i have a method productService.updateInstance() to do this. but how can i call this method after the changes has been made?

thank you and kind regards

like image 951
flowoo Avatar asked Apr 28 '13 07:04

flowoo


1 Answers

Use <p:ajax event="save"

save and cancel are two provided ajax behaviors events you can use to hook-in the editing process.

 <p:inplace id="ajaxInplace" editor="true">  
   <p:ajax event="save" listener="#{productService.handleSave}" update="someThing" />
   <p:inputText value="#{productService.instance.productName}" required="true"     label="text"/>     
 </p:inplace>

Where handleSave looks like this

public void handleSave() {
    //do something here
}
like image 187
Daniel Avatar answered Oct 15 '22 06:10

Daniel