【问题标题】:Horizontal scroll in rich:panel to default right to left丰富的水平滚动:面板默认从右到左
【发布时间】:2012-12-07 00:12:56
【问题描述】:

我有一个 Rich:panel,里面有一个 style="overflow:scroll" 标签。默认情况下,滚动条从左向右滑动。我不断通过单击按钮将新的数据表添加到数据网格中,并且我希望用户始终看到最新的数据表,并且由于我已将其设置为将每个数据表作为列添加到数据网格中,因此最新的将始终位于 dataGrid 的右侧。有没有办法可以默认滚动从右到左?或者也许从右到左创建列?

这是我的面板的代码:

<rich:panel id="PREV" rendered="#{yieldSearch.update}" style = "overflow: scroll">
            <rich:dataGrid id="PT" value="#{yieldSearch.storeYieldTest}"
                    var="_yield" columns="#{yieldSearch.columns}">

            </rich:dataGrid>
            </rich:panel>

这是我的按钮:

<h:commandButton id="NXT" value="Add New Store" rendered="#{yieldSearch.update}" action="#     {yieldSearch.newStore()}" >

【问题讨论】:

    标签: xhtml richfaces scrollbar


    【解决方案1】:

    这有点难以回答,因为您没有提供任何代码示例。
    但是我认为您可以为此使用javascript。我假设您的 panel 结构如下。

    <rich:panel id="myPnl"........>
        <rich:dataGrid id="myGrid".............>
          .........
        </rich:dataGrid>
    </rich:panel>
    

    我假设您通过单击&lt;a4j:commandButton&gt; 并调用action 将dataTables 添加到dataGrid。如果是这样,将oncomplete 事件添加到&lt;a4j:commandButton&gt;,如下所示。

    <a4j:commandButton value="Add new data table" reRender="myPnl" oncomplete="#{rich:element('myPnl')}.scrollLeft += #{rich:element('myGrid')}.offsetWidth;"/>
    

    【讨论】:

    • 我最初有一个 h:button 但我切换到 a4j,它就像一个魅力。谢谢!
    猜你喜欢
    • 2021-08-12
    • 1970-01-01
    • 2019-10-22
    • 1970-01-01
    • 1970-01-01
    • 2014-07-16
    • 2012-04-07
    • 2017-03-30
    • 1970-01-01
    相关资源
    最近更新 更多