ICEfaces
  1. ICEfaces
  2. ICE-1052

RowStyle order on RowSelection-enabled dataTable alters when selecting row

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.5.2
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      from the forum: http://www.icefaces.org/JForum/posts/list/3036.page

      riginal code
      Code:

                   if (selectedClass != null) {
                       tr.setAttribute(HTML.CLASS_ATTR, selectedClass);
                   } else if (rowStylesMaxIndex >= 0) {
                       // if row styles exist, then render the appropriate one
                       tr.setAttribute(HTML.CLASS_ATTR, rowStyles[rowStyleIndex]);
                       if (++rowStyleIndex > rowStylesMaxIndex) {
                           rowStyleIndex = 0;
                       }
                   }
       



      Proposed code

      Code:

                   if (selectedClass != null) {
                       tr.setAttribute(HTML.CLASS_ATTR, selectedClass);
                       rowStyleIndex++; // !!! here is the difference.
                   } else if (rowStylesMaxIndex >= 0) {
                       // if row styles exist, then render the appropriate one
                       tr.setAttribute(HTML.CLASS_ATTR, rowStyles[rowStyleIndex]);
                       if (++rowStyleIndex > rowStylesMaxIndex) {
                           rowStyleIndex = 0;
                       }
                   }

        Activity

        Hide
        Rob Mayhew added a comment -

        Changed code to the following to avoid an array out of bounds exception.
        Check in r12592 in 1.5 branch

        if (selectedClass != null)

        { tr.setAttribute(HTML.CLASS_ATTR, selectedClass); }

        else if (rowStylesMaxIndex >= 0)

        { // if row styles exist, then render the appropriate one tr.setAttribute(HTML.CLASS_ATTR, rowStyles[rowStyleIndex]); }

        if(rowStylesMaxIndex >= 0){
        if (++rowStyleIndex > rowStylesMaxIndex)

        { rowStyleIndex = 0; }

        }

        Show
        Rob Mayhew added a comment - Changed code to the following to avoid an array out of bounds exception. Check in r12592 in 1.5 branch if (selectedClass != null) { tr.setAttribute(HTML.CLASS_ATTR, selectedClass); } else if (rowStylesMaxIndex >= 0) { // if row styles exist, then render the appropriate one tr.setAttribute(HTML.CLASS_ATTR, rowStyles[rowStyleIndex]); } if(rowStylesMaxIndex >= 0){ if (++rowStyleIndex > rowStylesMaxIndex) { rowStyleIndex = 0; } }
        Hide
        Rob Mayhew added a comment -

        verified

        Show
        Rob Mayhew added a comment - verified

          People

          • Assignee:
            Rob Mayhew
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: