单击铅笔调用侦听器(primefaces 2.2.1 rowEditor) [英] Call listener by clicking pencil (primefaces 2.2.1 rowEditor)
问题描述
在rowEditor上单击铅笔后,如何调用侦听器? 我想准备从dataTable中进行编辑的文本(清除html标签,以制表符并返回回车符). 你有什么想法? 谢谢.
How can I call listener after clicking pencil on rowEditor? I want to prepare text from dataTable for editing (clear html tags for tabs and return carriages). Do you have any ideas? Thank you.
推荐答案
此功能不适用于2.2.1版,但仍然与其他版本相关
2岁的问题,但这是Google排名最高的结果之一.
2 year old question but it's one of the top Google results.
有一种方法可以不使用<p:commandLink>
There is a way to do this without using <p:commandLink>
第154页的 Primefaces用户指南讨论了Ajax事件.有三个有趣的事件rowEdit, rowEditInit, rowEditCancel
.
The Primefaces User Guide on page 154 talks about ajax events. There are three events of interest rowEdit, rowEditInit, rowEditCancel
.
rowEditInit
是在行切换到编辑模式时触发的事件
rowEditCancel
是在取消行编辑时触发的事件
rowEditInit
is the event that triggers when a row switches to edit mode
rowEditCancel
is the event that triggers when a row edit is cancelled
因此您的代码应如下所示
So your code should look like this
<p:ajax event="rowEditInit" listener="#{tableBean.onEditInitCleanUp}" update="@form">
然后,您的听众将进行适当的清理.
Then your listener would do the appropriate clean up.
这篇关于单击铅笔调用侦听器(primefaces 2.2.1 rowEditor)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!