javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-426

<h:dataTable> "columnClasses" attribute doesn't work per spec

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 1.2_02
    • Fix Version/s: 1.2_03-b01
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      426

      Description

      According to the docs at
      "http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/": "If the number
      of elements in this list [of comma-separated values in the "columnClasses"
      attribute of h:dataTable] is less than the number of columns specified in the
      "columns" attribute, no "class" attribute is output for each column greater than
      the number of elements in the list. If the number of elements in the list is
      greater than the number of columns specified in the "columns" attribute, the
      elements at the posisiton in the list after the value of the "columns" attribute
      are ignored."

      First, there is no "columns" attribute in h:dataTable, according to the docs,
      and from what I could see in the current (1.2_02) RI.

      Second, the current implementation seems to repeatedly cycle through the values
      of columnClasses (much like the way rowClasses works) rather than behaving as
      described in the docs.

      Third, the spec really should be changed or enhanced to also allow a styleClass
      attribute to be applied to the <h:column> element instead of this system.

      The cycling isn't necessarily a bad behavior (the same use case as the current
      rowClasses attributes, for example an even vs. odd column class), as long as
      it's possible to still apply column styles without the cycling at the same time
      (perhaps the styleClass attribute I proposed in the previous paragraph).

        Activity

        Hide
        leonzzz added a comment -

        Ryan,
        I think this fix will impact the behavior h:dataTable, and CTS below should be
        impacted:
        jsf/spec/render/datatable/URLClient.java#dtableRenderEncodeBasicTest

        Let's watch clip of its jsp code:
        ...
        <h:dataTable id="data2"
        value="#

        {requestScope.DataList}

        "
        var="data2"
        rowClasses="odd,even"
        columnClasses="even,odd">
        <h:column>
        <h:outputText value="#

        {data2.name}

        "/>
        </h:column>
        <h:column>
        <h:outputText value="#

        {data2.gender}

        "/>
        </h:column>
        <h:column>
        <h:outputText value="#

        {data2.age}

        "/>
        </h:column>
        </h:dataTable>
        ...

        Accoding to your commnets, current behavior will be different from orginal one,
        right?

        Error log:
        [java] [java] 10-22-2006 15:50:58: ERROR: Test FAILED
        [java] [java] 10-22-2006 15:50:58: ERROR: --------------------------
        [java] [java] 10-22-2006 15:50:58: ERROR: Expected class attribute
        forcell(1,3) in table containing ID 'data2' to be 'even', received ''
        [java] [java] 10-22-2006 15:50:58: ERROR: Expected class attribute
        forcell(2,3) in table containing ID 'data2' to be 'even', received ''
        [java] [java] 10-22-2006 15:50:58: ERROR: Expected class attribute
        forcell(3,3) in table containing ID 'data2' to be 'even', received ''
        [java] [java] 10-22-2006 15:50:58: ERROR: --------------------------
        [java] [java] 10-22-2006 15:50:58: ERROR: Test FAILED. Check
        messages for details.

        Should current CTS code be modified to refect current behavior?

        Thanks

        Leon

        Show
        leonzzz added a comment - Ryan, I think this fix will impact the behavior h:dataTable, and CTS below should be impacted: jsf/spec/render/datatable/URLClient.java#dtableRenderEncodeBasicTest Let's watch clip of its jsp code: ... <h:dataTable id="data2" value="# {requestScope.DataList} " var="data2" rowClasses="odd,even" columnClasses="even,odd"> <h:column> <h:outputText value="# {data2.name} "/> </h:column> <h:column> <h:outputText value="# {data2.gender} "/> </h:column> <h:column> <h:outputText value="# {data2.age} "/> </h:column> </h:dataTable> ... Accoding to your commnets, current behavior will be different from orginal one, right? Error log: [java] [java] 10-22-2006 15:50:58: ERROR: Test FAILED [java] [java] 10-22-2006 15:50:58: ERROR: -------------------------- [java] [java] 10-22-2006 15:50:58: ERROR: Expected class attribute forcell(1,3) in table containing ID 'data2' to be 'even', received '' [java] [java] 10-22-2006 15:50:58: ERROR: Expected class attribute forcell(2,3) in table containing ID 'data2' to be 'even', received '' [java] [java] 10-22-2006 15:50:58: ERROR: Expected class attribute forcell(3,3) in table containing ID 'data2' to be 'even', received '' [java] [java] 10-22-2006 15:50:58: ERROR: -------------------------- [java] [java] 10-22-2006 15:50:58: ERROR: Test FAILED. Check messages for details. Should current CTS code be modified to refect current behavior? Thanks Leon
        Hide
        dmlloyd added a comment -

        You know, if the CTS expects columnClasses to work like rowClasses, and the RI
        was originally implemented that way, it seems more and more like an error in the
        spec/docs and not the RI... perhaps this change to the RI should be reverted,
        and the styleClass attribute be added to h:column.

        This has the added benefit of being compatible with all the other stuff out
        there today, including other implementations that strive to be compatible with
        the CTS

        I think that the way that the columnClasses attribute worked before this fix is
        perfectly reasonable behavior, and consistent with rowClasses; as long as the
        ability to specify absolute column classes is retained as well some other way,
        then I would still consider this issue resolved in a satisfactory manner.

        Even though the spec doesn't say anything about adding a styleClass attribute to
        h:column, I think this is a "safe" change, because it won't break any
        applications that don't know about this attribute.

        Show
        dmlloyd added a comment - You know, if the CTS expects columnClasses to work like rowClasses, and the RI was originally implemented that way, it seems more and more like an error in the spec/docs and not the RI... perhaps this change to the RI should be reverted, and the styleClass attribute be added to h:column. This has the added benefit of being compatible with all the other stuff out there today, including other implementations that strive to be compatible with the CTS I think that the way that the columnClasses attribute worked before this fix is perfectly reasonable behavior, and consistent with rowClasses; as long as the ability to specify absolute column classes is retained as well some other way, then I would still consider this issue resolved in a satisfactory manner. Even though the spec doesn't say anything about adding a styleClass attribute to h:column, I think this is a "safe" change, because it won't break any applications that don't know about this attribute.
        Hide
        Ryan Lubke added a comment -

        I'm going to revert this change.

        Show
        Ryan Lubke added a comment - I'm going to revert this change.
        Hide
        Ryan Lubke added a comment -

        Changes reverted and tests updated. TCK should be back to normal.

        Show
        Ryan Lubke added a comment - Changes reverted and tests updated. TCK should be back to normal.
        Hide
        Manfred Riem added a comment -

        Closing out issue

        Show
        Manfred Riem added a comment - Closing out issue

          People

          • Assignee:
            Ryan Lubke
            Reporter:
            dmlloyd
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: