[英]DataTable - InCell Editing How to get the Value of the object edited in the Managed Bean
I want to get the row as object in My managed bean with its updated properties. 我想以其更新的属性将行作为“我的托管Bean”中的对象。 I used the PrimeFaces showcase example DataTable - InCell Editing .
我使用了PrimeFaces展示示例DataTable-InCell编辑 。 I don't understand how to get the edited values to update the database.
我不明白如何获取编辑后的值来更新数据库。 How can I achieve this?
我该如何实现?
Just add a save button to the same form. 只需将保存按钮添加到同一表单即可。 Eg
例如
<p:commandButton value="Save" action="#{bean.save}" />
with 与
public void save() {
someService.save(someList);
}
Or, if you want to perform the save on every individual row edit event, then add a <p:ajax event="rowEdit">
to the <p:dataTable>
. 或者,如果要对每个单独的行编辑事件执行保存,则将
<p:ajax event="rowEdit">
到<p:dataTable>
。 Eg 例如
<p:dataTable ...>
...
<p:column>
<p:rowEditor />
</p:column>
<p:ajax event="rowEdit" listener="#{bean.save}" />
</p:dataTable>
with 与
public void save(RowEditEvent event) {
someService.save((SomeItem) event.getObject());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.