有没有人用commandButton打开和关闭rich:dataScroller?我是否需要创建一个bean来跟踪rich:dataScroller是否处于活动状态,并执行commandButton的操作来切换该bean?
发布于 2012-11-17 13:37:09
你说开/关是什么意思?它的意思是显示/隐藏吗?如果是这样的话,你可以这样做。假设您有一个下面的表,该表下面有一个datascroller和一个commandButton。
<h:form>
<rich:dataTable var="_usr" value="#{myBean.users}" rows="5">
<rich:column>
#{_usr.userName}
</rich:column>
<f:facet name="footer">
<rich:datascroller id="myScroller" />
</f:facet>
</rich:dataTable>
<a4j:commandButton value="Show/Hide" onclick="toggleScroller(#{rich:element('myScroller')});"/>
</h:form>显示/隐藏datascroller的javascript函数如下所示。
<script>
function toggleScroller(scroller) {
if(scroller.style.display == 'none') {
scroller.style.display = ''
} else {
scroller.style.display = 'none'
}
}
</script>或者,您可以使用<rich:datascroller>的rendered属性根据bean属性来呈现它。
https://stackoverflow.com/questions/13423416
复制相似问题