仅在手风琴 Primefaces 选项卡上更新 [英] Update just on Tab of accordion Primefaces

查看:26
本文介绍了仅在手风琴 Primefaces 选项卡上更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有动态标签数量的手风琴.选项卡标题被设置为一个 CSS 类.这会使背景以太变绿或变红,具体取决于订单中的所有商品是否都已送达.

I have an accordion with a dynamic number of tabs. The tab title gets set to a CSS class. This makes the background ether green or red, depending on if all the articles in the order are delivered.

对于每篇文章都有一个 selectBooleanButton,并且在这些按钮的每次更改时,实际的选项卡都应该更新.

For every article there is a selectBooleanButton and on every change of these buttons the actual tab should get updated.

问题是:如何只更新一个标签页?当我更新整个手风琴时,第一个选项卡打开,另一个关闭.

The problem is: how can I update just one tab? When I update the whole accordion the first tab opens and the other get closed.

<p:accordionPanel id="ordersAccordion" cache="true" value="#{ordersBean.orders}" var="order">
        <p:tab
            titleStyleClass="#{ordersBean.isOrderDelivered(order) ? 'ui-accordion-tab-delivered' : 'ui-accordion-tab-undelivered'}"
            title="##{order.order_id} | #{order.printableOrderDate}  | #{order.printableOrderTime} | #{order.user} | #{order.getDestination().toString()}">
            <p:dataTable value="#{order.demands}" var="demand">
                <p:column headerText="Artikel Nr.">
                    <p:outputLabel value="#{demand.article.articleNumber}" />
                </p:column>
                <p:column headerText="Name">
                    <p:outputLabel value="#{demand.article.name}" />
                </p:column>
                <p:column headerText="Beschreibung">
                    <p:outputLabel value="#{demand.article.description}" />
                </p:column>
                <p:column headerText="Haus">
                    <p:outputLabel value="#{demand.house.getLabel()}" />
                </p:column>
                <p:column headerText="Anzahl">
                    <p:outputLabel value="#{demand.quantity}" />
                </p:column>
                <p:column headerText="Mitarbeiter">
                    <p:outputLabel value="#{demand.employee}" />
                </p:column>
                <p:column headerText="Lieferstand" width="150" style="text-align: center">
                    <p:selectBooleanButton id="deliverdBtn" value="#{demand.delivered}" onLabel="Geliefert" offLabel="Geliefert" onIcon="ui-icon-check"
                        offIcon="ui-icon-close">
                        <p:ajax listener="#{ordersBean.saveDelivered(demand)}" update=":allOrders:ordersAccordion" />
                    </p:selectBooleanButton>
                </p:column>
            </p:dataTable>
        </p:tab>
</p:accordionPanel>

推荐答案

AccordionPanel 有一个 activeIndex 属性,您可以使用它来处理当前选项卡.你应该能够做这样的事情:

The AccordionPanel has an activeIndex attribute which you can use to work on the current tab. You should be able to do something like this:

<p:ajax listener="#{ordersBean.saveDelivered(demand)}" update=":allOrder:ordersAccordion:tab#{ordersAccordion.activeIndex}" />

这篇关于仅在手风琴 Primefaces 选项卡上更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆