facelets
  1. facelets
  2. FACELETS-372

ui:repeat doesn't accept ValueExpressions for "var" and "varStatus" - useful for composite components

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: ALL
    • Fix Version/s: None
    • Component/s: impl
    • Labels:
      None

      Description

      UI:repeat only accepts Strings and not ValueExpressions for both var and varStatus attributes - using a ValueExpression to define these attribute values doesn't work even though the Documentation mentions possible use of ValueExpressions.

      The use case we have is in a composite component that uses an ui:repeat in the implementation and lets the user specify the var attribute.

      <timeline:timeline events="#

      {eventHistoryView.eventList}

      " var="event" varStatus="eventStatus">
      <timeline:event title="#

      {event.summary}

      "/>
      </timeline:timeline>

      The component's implementation would be something like this:

      — timeline/timeline.xhtml —

      <cc:interface>
      <cc:attribute name="events" required="true"/>
      <cc:attribute name="var" required="true"/>
      <cc:attribute name="varStatus" default="status"/>
      </cc:interface>
      <cc:implementation>
      <div id="#

      {cc.clientId}

      " style="height: 150px; border: 1px solid #aaa"/>
      <ui:repeat var="#

      {cc.attrs.var}

      " value="#

      {cc.attrs.events}

      " varStatus="#

      {cc.attrs.varStatus}

      ">
      <cc:insertChildren/>
      </ui:repeat>
      </cc:implementation>

      — timeline/event.xhtml —

      <cc:interface>
      <cc:attribute name="title"/>
      ...
      </cc:interface>
      <cc:implementation>
      Title: #

      {cc.attrs.title}

      ...
      </cc:implementation>

      We're attaching a patch to UIRepeat that uses getters similar to begin, end, etc... for var and varStatus.
      We've also changed every direct use of the field var/varStatus with getVar()/getVarStatus().

      We know there are some other workarounds, and we could use the ui:repeat in timeline/event component, but still it'd seem to make sense to allow ValueExpressions for var and varStatus, doesn't it?

      1. UIRepeat.diff
        4 kB
        swehner33
      2. UIRepeat.java.patched
        32 kB
        swehner33

        Activity

        Hide
        vindum added a comment -

        Any news on this? Will this be fixed in a future release?

        Show
        vindum added a comment - Any news on this? Will this be fixed in a future release?

          People

          • Assignee:
            Unassigned
            Reporter:
            swehner33
          • Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: