ICEfaces
  1. ICEfaces
  2. ICE-1280

TableRenderer calling UIData.setRowIndex one too many times when paging.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.6DR#4, 1.6
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      any

      Description

      Noted in the following forum posts:

      http://www.icefaces.org/JForum/posts/list/3314.page
      http://www.icefaces.org/JForum/posts/list/3820.page
      http://www.icefaces.org/JForum/posts/list/2895.page
      http://www.icefaces.org/JForum/posts/list/3280.page

      TableRenderer.encodeChildren calls the setRowIndex for rows pageIndex*(0-10) when it should only be calling pageIndex*(0-9)

      The following patch is suggested:

      TableRenderer.java 2007-02-23 11:08:36.000000000 -0700
      @@ -330,13 +330,17 @@
               }
       
               String columnStyles[] = getColumnStyleClasses(uiComponent);
               int columnStyleIndex = 0;
               int columnStylesMaxIndex = columnStyles.length - 1;
               while (uiData.isRowAvailable()) {
      - String selectedClass =null;
      + if ((numberOfRowsToDisplay > 0) &&
      + (countOfRowsDisplayed >= numberOfRowsToDisplay)) {
      + break;
      + }
      + String selectedClass =null;
                   Iterator childs = uiData.getChildren().iterator();
                   Element tr = (Element) domContext.createElement(HTML.TR_ELEM);
                   if (rowSelectorFound) {
                       tr.setAttribute("onclick", rowSelectionFunctionName + "('" +
                                                  uiData.getRowIndex() + "');");
                   }
      @@ -432,17 +436,12 @@
                           }
                       }
       
                   }
                   rowIndex++;
                   countOfRowsDisplayed++;
      - if (numberOfRowsToDisplay > 0
      - && countOfRowsDisplayed >= numberOfRowsToDisplay) {
      - break;
      - }
      -
                   uiData.setRowIndex(rowIndex);
               }
               uiData.setRowIndex(-1);
               domContext.stepOver();
               domContext.streamWrite(facesContext, uiComponent);
           }

        Activity

        Hide
        Philip Breau added a comment -

        sorry, that diff was backwards:

        — TableRenderer.java 2007-02-26 11:43:44.000000000 -0700
        @@ -330,17 +330,13 @@
        }

        String columnStyles[] = getColumnStyleClasses(uiComponent);
        int columnStyleIndex = 0;
        int columnStylesMaxIndex = columnStyles.length - 1;
        while (uiData.isRowAvailable()) {

        • if ((numberOfRowsToDisplay > 0) &&
        • (countOfRowsDisplayed >= numberOfRowsToDisplay)) { - break; - }
        • String selectedClass =null;
          + String selectedClass =null;
          Iterator childs = uiData.getChildren().iterator();
          Element tr = (Element) domContext.createElement(HTML.TR_ELEM);
          if (rowSelectorFound) { tr.setAttribute("onclick", rowSelectionFunctionName + "('" + uiData.getRowIndex() + "');"); }

          @@ -436,12 +432,17 @@
          }
          }

        }
        rowIndex++;
        countOfRowsDisplayed++;
        + if (numberOfRowsToDisplay > 0
        + && countOfRowsDisplayed >= numberOfRowsToDisplay)

        { + break; + }

        +
        uiData.setRowIndex(rowIndex);
        }
        uiData.setRowIndex(-1);
        domContext.stepOver();
        domContext.streamWrite(facesContext, uiComponent);
        }

        Show
        Philip Breau added a comment - sorry, that diff was backwards: — TableRenderer.java 2007-02-26 11:43:44.000000000 -0700 @@ -330,17 +330,13 @@ } String columnStyles[] = getColumnStyleClasses(uiComponent); int columnStyleIndex = 0; int columnStylesMaxIndex = columnStyles.length - 1; while (uiData.isRowAvailable()) { if ((numberOfRowsToDisplay > 0) && (countOfRowsDisplayed >= numberOfRowsToDisplay)) { - break; - } String selectedClass =null; + String selectedClass =null; Iterator childs = uiData.getChildren().iterator(); Element tr = (Element) domContext.createElement(HTML.TR_ELEM); if (rowSelectorFound) { tr.setAttribute("onclick", rowSelectionFunctionName + "('" + uiData.getRowIndex() + "');"); } @@ -436,12 +432,17 @@ } } } rowIndex++; countOfRowsDisplayed++; + if (numberOfRowsToDisplay > 0 + && countOfRowsDisplayed >= numberOfRowsToDisplay) { + break; + } + uiData.setRowIndex(rowIndex); } uiData.setRowIndex(-1); domContext.stepOver(); domContext.streamWrite(facesContext, uiComponent); }
        Hide
        Adnan Durrani added a comment -

        The suggested patch tested and applied. -r 13339

        Show
        Adnan Durrani added a comment - The suggested patch tested and applied. -r 13339
        Hide
        Frank Ye added a comment -

        using com.sun.rave.faces.data.CachedRowSetDataModel will have 0 rows.

        Show
        Frank Ye added a comment - using com.sun.rave.faces.data.CachedRowSetDataModel will have 0 rows.
        Hide
        Adnan Durrani added a comment -

        This bug does not have any regression. Please see the following bug for com.sun.rave.faces.data.CachedRowSetDataModel issue:
        http://jira.icefaces.org/browse/ICE-1471

        Show
        Adnan Durrani added a comment - This bug does not have any regression. Please see the following bug for com.sun.rave.faces.data.CachedRowSetDataModel issue: http://jira.icefaces.org/browse/ICE-1471

          People

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

            Dates

            • Created:
              Updated:
              Resolved: