简体   繁体   中英

How do I get h:outputText inside of a ui:repeat nested in h:dataTable to update when the datatable is updated?

So the relevant sections of my code is:

<h:panelGroup id="pnlGrp" style="padding:10px" width="100%">
    <div>
        <h:dataTable id="availableCrList"
                       value="#{searchData.availableCrList}"
                       var="avail"
                       varStatus="thisVarStatus" rows="#{searchData.rowsPerPage}"
                       sortColumn="#{searchData.crSortColumnName}"
                       sortAscending="#{searchData.crAscending}" style="width:100%;">
            <h:column>
                <ui:repeat value="#{avail.crRsnCdList}"
                            var="crRsnCd"
                            varStatus="status">
                    <h:outputText value="#{crRsnCd}&lt;br /&gt;"
                                    title="#{avail.crRsnDescList[status.index]}"
                                    escape="false"/>
                </ui:repeat>
            </h:column>
        </h:dataTable>
    </div>
</h:panelGroup>

I'm working inside a legacy application and my goal is to display a list of codes which indicate reasons why a given item in this table might be completed, or cancelled, et cetera. The title is converted into a hovering tooltip which displays the description for each of these codes.

Now, I managed to get this working for singular codes no problem, but since switching from a String to a List of strings it's been a nightmare trying to get this to work.

Right now with the above code it displays the codes correctly the first time, but when I update the datatable by searching for a new value all the other columns (not shown) are correctly displayed while the RsnCd column continues to display the same data from the first search.

As an example, the first time I search for records the datatable might pull up:

Row1:A1
Row2:A1
Row3:A1
     A3
Row4:A1

The second time I search for data I would expect to see only:

Row1:
Row2:
Row3:
Row4:
Row5:
Row6:
Row7:

But instead I get:

Row1:A1
Row2:A1
Row3:A1
     A3
Row4:A1
Row5:
Row6:
Row7:

Really not sure if I'm explaining this adequately/understandably.

I solved this issue by changing

<ui:repeat value="#{avail.crRsnCdList}"
           var="crRsnCd"
           varStatus="status">
    <h:outputText value="#{crRsnCd}&lt;br /&gt;"
                  title="#{avail.crRsnDescList[status.index]}"
                  escape="false"/>
</ui:repeat>

To:

<ice:column>
    <ice:repeat value="#{avail.crRsnCdList}"
                varStatus="status">
        <ice:outputText value="#{avail.crRsnCdList[status.index]}&lt;br /&gt;"
                        title="#{avail.crRsnDescList[status.index]}"
                        escape="false"/>
    </ice:repeat>
</ice:column>

I tried getting rid of the value but it stopped displaying anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM