我是富表面4.1的usig jsf,想要以与展示中相同的方式修改表格内容(删除给定行):
但在我的情况下,不会调用支持bean函数。我也尝试在a4j:jsFunction oncomplete事件中插入alert(),但也没有调用,甚至试图直接从弹出窗口的命令按钮调用deleteArchive()函数。
我在这个主题中读过不同的文章,但都没有解决我的问题。
我的代码如下:
<h:form class="page_frame">
<rich:dataTable value="#{RunArchiveBean.archivedRuns}" var="run" id="run_table" style="margin-top: 50px; border: none !important; margin-left: auto; margin-right: auto;">
<f:facet name="header">
<h:outputText class="output_text_header" value="Session Run History" />
</f:facet>
<rich:column filterValue="#{RunArchiveBean.sessionNameFilter}"
filterExpression="#{fn:containsIgnoreCase(run.session.sessionName,RunArchiveBean.sessionNameFilter)}">
<f:facet name="header">Session Name
<h:inputText value="#{RunArchiveBean.sessionNameFilter}">
<a4j:ajax event="keyup" render="run_table@body" execute="@this" />
</h:inputText>
</f:facet>
<h:outputText value="#{run.session.sessionName}"></h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">Network</f:facet>
<h:outputText value="#{run.session.network}"></h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">Network Element</f:facet>
<h:outputText value="#{run.session.networkElement}"></h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">Creation Date of Session</f:facet>
<h:outputText value="#{run.session.creationDate}"></h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">Run Date of Session</f:facet>
<h:outputText value="#{run.logDate}"></h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">Results</f:facet>
<a4j:commandLink execute="@this" action="#{SessionActionBean.showSessionLog(run.session, run.logDate)}" >
<h:graphicImage id="log_image" name="log.png" library="images" style="border:0" />
<rich:tooltip followMouse="true" target="log_image" value="Log" />
</a4j:commandLink>
<a4j:commandLink execute="@this" action="#{AnalyzerBean.setup(run.session, run.logDate)}">
<h:graphicImage id="ida_icon" name="idaicon.png" library="images" style="border:0" />
<rich:tooltip followMouse="true" target="ida_icon" value="IDA Results" />
</a4j:commandLink>
<h:commandLink id="hitLink" action="#{TraceBean.traceRead(run.session,run.logDate)}" disabled="#{!RunArchiveBean.fileExists(run.session, run.logDate, 'traceResult.log')}">
<h:graphicImage id="hit_icon" name="#{RunArchiveBean.getHitIcon(run.session,run.logDate)}" library="images" style="border:0" />
<rich:tooltip followMouse="true" target="hit_icon" value="HIT Results" />
</h:commandLink>
<a4j:commandLink id="delete_result" rendered="#{SessionActionBean.checkUserLevel()}" execute="@this" render="@none" onclick="#{rich:component('delete_archive')}.show();">
<h:graphicImage id="delete_icon" name="delete.png" library="images" style="border:0"/>
<rich:tooltip followMouse="true" target="delete_icon" value="Remove archived run" />
<a4j:param value="#{run.index}" assignTo="#{RunArchiveBean.indexofDeleteArchive}"/>
</a4j:commandLink>
</rich:column>
</rich:dataTable>
<rich:jQuery selector="#run_table tr:odd" query="addClass('odd-row')" />
<rich:jQuery selector="#run_table tr:even" query="addClass('even-row')" />
<a4j:jsFunction name="deleteArchive" action="#{RunArchiveBean.removeArchivedRun}" render="run_table" execute="@this" oncomplete="#{rich:component('delete_archive')}.hide();" />
<rich:popupPanel id="delete_archive" autosized="true" resizeable="false"
onmaskclick="#{rich:component('delete_archive')}.hide();">
<f:facet name="header">
<h:outputText value="Deleting archived run" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('delete_archive')}.hide();">
<h:graphicImage name="close.png" library="images" />
</h:outputLink>
</f:facet>
<table>
<tr>
<td>
<h:outputText value="Are you sure to delete selected results?" />
</td>
</tr>
<tr>
<td>
<a4j:commandButton styleClass="fieldset_button" value="Yes" onclick="callRemove(); #{rich:component('delete_archive')}.hide(); return false;"/>
</td>
<td>
<a4j:commandButton styleClass="fieldset_button" value="Cancel" onclick="#{rich:component('delete_archive')}.hide();" />
</td>
</tr>
</table>
</rich:popupPanel>
</h:form>
使用脚本:
function callRemove() {
deleteArchive();
}
有什么想法吗?任何帮助将不胜感激。
更新#1:
a4j:jsFunction在客户端生成以下脚本:
<script type="text/javascript"><!--
deleteArchive=function(){RichFaces.ajax("j_id_1d:j_id_2d",null,{"incId":"1"} )};
//--></script>
更新#2:
直接从a4j:commandButton action属性调用removeArchivedRun()函数也不起作用,但调用其他JavaScript表单onclick方法,如alert(&#39;它工作!),可以正常工作。
答案 0 :(得分:0)
尝试在弹出式面板中移入deleteArchive jsFunction并直接调用它而不是callRemove