MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-1615

Auto-ID-generation does not respect rowIndex in facet="detailStamp"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.1.11
    • Fix Version/s: None
    • Component/s: Extended Datatable
    • Labels:
      None
    • Environment:
      JSF 1.1, MyFaces 1.1.5

      Description

      Generated IDs of components in a facet="detailStamp" of a t:dataTable are assigned the same row index for all rows. For each ID, the row index "0" of the first row is used.

      Furthermore the content of the variable "rowIndexVar" is empty, when it is used in the id-attribute. It is not empty for e.g. the attributes "title" or "value".

        Activity

        Hide
        Achim Hensel added a comment - - edited

        Demonstration code:

        =========================================================
        <t:dataTable
        id="demoTable"
        value="#

        {bean.twoEntryList}

        "
        var="valueHolder"
        rowIndexVar="riv"
        detailStampExpandedDefault="true"
        varDetailToggler="detailToggler">
        <t:column>
        <f:facet name="header">Header</f:facet>
        <h:commandLink action="#

        {detailToggler.toggleDetail}

        ">Toggle #

        {riv}</h:commandLink>
        </t:column>
        <f:facet name="detailStamp">
        <t:outputText id="otid_#{riv}

        " title="T_#

        {riv}" value="V_#{riv}

        "></t:outputText>
        </f:facet>
        </t:dataTable>
        =========================================================

        Actual output (new formatted):

        =========================================================
        <table id="reportList:demoTable">
        <thead><tr><th>Header</th></tr></thead>
        <tbody id="reportList:demoTable:tbody_element">
        <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:0:_id60');" id="reportList:demoTable:0:_id60">Toggle 0</a></td></tr>
        <tr><td colspan="1"><span id="reportList:demoTable:0:otid_" title="T_0">V_0</span></td></tr>
        <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:1:_id60');" id="reportList:demoTable:1:_id60">Toggle 1</a></td></tr>
        <tr><td colspan="1"><span id="reportList:demoTable:0:otid_" title="T_1">V_1</span></td></tr>
        </tbody></table>
        =========================================================

        Expected output:

        =========================================================
        <table id="reportList:demoTable">
        <thead><tr><th>Header</th></tr></thead>
        <tbody id="reportList:demoTable:tbody_element">
        <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:0:_id60');" id="reportList:demoTable:0:_id60">Toggle 0</a></td></tr>
        <tr><td colspan="1"><span id="reportList:demoTable:0:otid_0" title="T_0">V_0</span></td></tr>
        <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:1:_id60');" id="reportList:demoTable:1:_id60">Toggle 1</a></td></tr>
        <tr><td colspan="1"><span id="reportList:demoTable:1:otid_1" title="T_1">V_1</span></td></tr>
        </tbody></table>
        =========================================================

        Notice the different IDs of the detailStamp span (id="reportList:demoTable:0:otid_0" vs. "reportList:demoTable:0:otid").

        This error also influences the "t:inputCalendar" component, and irritates the "t:updateActionListener" of a "t:commandLink".

        Further input can be provided.

        Show
        Achim Hensel added a comment - - edited Demonstration code: ========================================================= <t:dataTable id="demoTable" value="# {bean.twoEntryList} " var="valueHolder" rowIndexVar="riv" detailStampExpandedDefault="true" varDetailToggler="detailToggler"> <t:column> <f:facet name="header">Header</f:facet> <h:commandLink action="# {detailToggler.toggleDetail} ">Toggle # {riv}</h:commandLink> </t:column> <f:facet name="detailStamp"> <t:outputText id="otid_#{riv} " title="T_# {riv}" value="V_#{riv} "></t:outputText> </f:facet> </t:dataTable> ========================================================= Actual output (new formatted): ========================================================= <table id="reportList:demoTable"> <thead><tr><th>Header</th></tr></thead> <tbody id="reportList:demoTable:tbody_element"> <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:0:_id60');" id="reportList:demoTable:0:_id60">Toggle 0</a></td></tr> <tr><td colspan="1"><span id="reportList:demoTable:0:otid_" title="T_0">V_0</span></td></tr> <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:1:_id60');" id="reportList:demoTable:1:_id60">Toggle 1</a></td></tr> <tr><td colspan="1"><span id="reportList:demoTable:0:otid_" title="T_1">V_1</span></td></tr> </tbody></table> ========================================================= Expected output: ========================================================= <table id="reportList:demoTable"> <thead><tr><th>Header</th></tr></thead> <tbody id="reportList:demoTable:tbody_element"> <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:0:_id60');" id="reportList:demoTable:0:_id60">Toggle 0</a></td></tr> <tr><td colspan="1"><span id="reportList:demoTable:0:otid_0" title="T_0">V_0</span></td></tr> <tr><td><a href="#" onclick="return oamSubmitForm('reportList','reportList:demoTable:1:_id60');" id="reportList:demoTable:1:_id60">Toggle 1</a></td></tr> <tr><td colspan="1"><span id="reportList:demoTable:1:otid_1" title="T_1">V_1</span></td></tr> </tbody></table> ========================================================= Notice the different IDs of the detailStamp span (id="reportList:demoTable:0:otid_0" vs. "reportList:demoTable:0:otid"). This error also influences the "t:inputCalendar" component, and irritates the "t:updateActionListener" of a "t:commandLink". Further input can be provided.
        Hide
        Achim Hensel added a comment -

        I also get a similar behaviour to TOMAHAWK-587, when I use a t:commandLink in the detailStamp. I assume this is due to the duplicated IDs.

        Show
        Achim Hensel added a comment - I also get a similar behaviour to TOMAHAWK-587 , when I use a t:commandLink in the detailStamp. I assume this is due to the duplicated IDs.
        Hide
        Leonardo Uribe added a comment -

        The problem is not related to tomahawk. Instead, it is a problem about use value expressions in "id" inside a iteration component.

        <t:outputText id="otid_#

        {riv}

        " ...

        The id is only evaluated once in build view time. In that time, "riv" is not bound to any value so an empty string is returned.

        The same will happen with any other iteration component like ui:repeat, h:dataTable and others.

        Since we can't do anything else, I'll close this issue as invalid.

        Show
        Leonardo Uribe added a comment - The problem is not related to tomahawk. Instead, it is a problem about use value expressions in "id" inside a iteration component. <t:outputText id="otid_# {riv} " ... The id is only evaluated once in build view time. In that time, "riv" is not bound to any value so an empty string is returned. The same will happen with any other iteration component like ui:repeat, h:dataTable and others. Since we can't do anything else, I'll close this issue as invalid.

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Achim Hensel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development