ajax commandButton的RichFaces问题
Posted
技术标签:
【中文标题】ajax commandButton的RichFaces问题【英文标题】:RichFaces problem with ajax commandButton 【发布时间】:2010-12-26 10:06:48 【问题描述】:您好,我对<a4j:commandButton>
有疑问
在我出于某种原因按下它之后,此页面上的所有按钮都在改变它们的样式
任何建议都会非常感激 我上传了一个视频,显示我的问题@ 0:10 秒 http://www.screencast.com/users/Schyzotrop/folders/Jing/media/b54aece2-4a97-45dc-99eb-76a7fbe29002 谢谢
<a4j:form id="form" ajaxSubmit="true">
<a4j:commandButton id="butNC" limitToList="true" action="#category.createSetup" value="New Category" />
<a4j:commandButton reRender="catDataScroller" onclick=""></a4j:commandButton>
<rich:dataTable id="categoryList" value="#category.categoryItems"
var="item" rows="10" >
<f:facet name="header">
<h:outputText value="Listing Category Items" />
</f:facet>
<rich:column style="text-align:center">
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#item.name" />
</rich:column>
<rich:column >
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
<h:outputText value="#item.description"/>
</rich:column>
<rich:column style="text-align:center">
<f:facet name="header">
<h:outputText value="Actions"/>
</f:facet>
<a4j:commandButton value="Show" action="#category.detailSetup">
<f:param name="jsfcrud.currentCategory" value="#jsfcrud_class['classes.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][category.converter].jsfcrud_invoke"/>
</a4j:commandButton>
<h:outputText value=" "/>
<a4j:commandButton value="Edit" action="#category.editSetup">
<f:param name="jsfcrud.currentCategory" value="#jsfcrud_class['classes.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][category.converter].jsfcrud_invoke"/>
</a4j:commandButton>
<h:outputText value=" "/>
<a4j:commandButton value="Destroy" limitToList="true" action="#category.destroy" type="submit">
<%--<f:param name="jsfcrud.currentCategory" value="#jsfcrud_class['classes.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][category.converter].jsfcrud_invoke"/>--%>
<h:outputText value="#item.categoryID"/>
<h:outputText value=" #jsfcrud_class['classes.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][category.converter].jsfcrud_invoke"/>
<f:param name="catID" value="#item.categoryID"/>
</a4j:commandButton>
</rich:column>
</rich:dataTable>
<rich:spacer />
<rich:datascroller id="catDataScroller" for="categoryList" maxPages="10"/>
<rich:messages style="color:red"></rich:messages>
</a4j:form>
【问题讨论】:
我认为是 3.3.0 添加库的屏幕截图...screencast.com/t/NmZiZjY3ZGM 您是否尝试在要在 ajax 操作中重新渲染的元素周围指定a4j:region
?
问题似乎是重新渲染时,样式没有加载
这让我问 - 你的脚本和样式加载策略是什么?
我是 Richfaces 技术和 J2EE 的新手,老实说,我不知道你所说的脚本/样式加载策略是什么意思...你能建议我一些可以找到任何信息的资源吗?他们?可能我根本没有任何“加载策略”。我假设框架会为我做这件事,但如果样式完全丢失,为什么表格仍然按应有的格式格式化?只有按钮失去了样式
【参考方案1】:
在加载rich:dataTable 时,它只是分配a4j:commandButton 的默认styleClass,但是当您单击所有设置为默认css 样式的按钮时。你没有提到 a4j:commmandButton 的 styleClass 属性。
例如以这个为例。
<a4j:commandButton value="Confirm" styleClass="buttonstyle prisefont15" style="width:100px; height:30px; cursor:pointer;" action="#DraftZoneBean.confirmAction" immediate="true" reRender="draftzoneForm">
</a4j:commandButton>
【讨论】:
以上是关于ajax commandButton的RichFaces问题的主要内容,如果未能解决你的问题,请参考以下文章
JSF f:ajax 监听器 vs commandButton 动作
commandButton / commandLink / ajax动作/侦听器方法未调用或输入值未设置/更新
commandButton/commandLink/ajax action/listener method not invoked or input value not updated