You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "David Brainard (JIRA)" <de...@myfaces.apache.org> on 2007/10/16 22:36:50 UTC

[jira] Created: (TOMAHAWK-1133) Data Scroller doesnt honor dynamic rowclasses during pagination

Data Scroller doesnt honor dynamic rowclasses during pagination
---------------------------------------------------------------

                 Key: TOMAHAWK-1133
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1133
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Data Scroller
         Environment: Myfaces 1.1.5, Tomahawk 1.1.7snapshot, Tomahawk 1.1.6, Tomcat 6.0
            Reporter: David Brainard


While using a data scroller with datatable if we specify the rowclasses dynamically(through value binding) only the first page gets the rowclasses assigned properly . When we try to do pagination and go to other page the same rowclasses which were used in the first page repeats i.e the rowclasses doesnt get assigned properly.
for e.g;  if i have a tag defined like this

                       <t:dataTable id="myDetailDataTable" var="row"
			value="#{testBean.dataList}" columnClasses="#{testBean.styleClass}"
			headerClass="headerClass" footerClass="footerClass"
			rowClasses="#{testBean.rowClass}" styleClass="dataTable" rows="3" >

and my rowclass returns something like this

       public String getRowClass() {
		return "rowOdd,rowOdd,rowEven,rowEven,rowEven,rowOdd";
	}

in first page the generated rowclasses are correct which is as follws:
            
             1st row:rowOdd, 
              2st row:rowOdd,
             3st row: rowEven

but when i navigate to next page the rowclasses assignment remains the same as first page. 
            1st row:rowOdd, 
              2st row:rowOdd,
             3st row: rowEven

but it should be as follows:

             1st row:rowEven, 
              2st row:rowEven,
             3st row: rowOdd
                 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1133) Data Scroller doesnt honor dynamic rowclasses during pagination

Posted by "David Brainard (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12535568 ] 

David Brainard commented on TOMAHAWK-1133:
------------------------------------------

Hi Zdenek ,

According to the API docs 
"we keep iterating through the list until we reach the end," 

i.e the list of row classes should be iterated till the end. 

consider a case in which the no of columns rendered in the first page is less than the size of the the list of rowclasses 
for e.g:
the no of rows rendered in the fist page is 3 but the size of rowclass list is 6 as given in the example above(bug description),

Then the behavior should be something like this:
the rows in the first page should have the the first three items of the list assigned to them and the 3 rows in the next page should have the next 3 styles assigned to them since we have to iterate till the end of the rowclasses. Now that we have reached the end of the list the next page will have the rowclasses assigned from the starting of the list i.e the pattern of the rowclasses will be repeated for every 2 pages in this case.

But the behavior which we have now is something like as follows:
the rows in the first page have the classes assigned to them correctly but when we go to the next page we get the same first three rowclasses assigned to them in spite of the fact that we have not iterated till the end of the rowclasses list.

The actual problem is that the rowclasses are not iterated till the end. They are just iterated for every page from the starting. 
I have looked into this problem. The problem is in this piece of code in HtmlTableRendererBase

 if (nc == 0) {
                	// first column in table, start new row
                    beforeRow(facesContext, uiData);

                    HtmlRendererUtils.writePrettyLineSeparator(facesContext);
                    renderRowStart(facesContext, writer, uiData, styles, nr );
                }

The rowStyleIndex i.e nr which is passed to the method renderRowStart is the actual problem. Since it is a counter it starts every time from 0 and even when i navigate to the next page it starts from 0 so this causes the table to render the classes corresponding to the first page rather than the good classes.

this fails for the particular case where "no of rowclasses"  > "no of rows rendered in a particular page".

so if we pass the actual row no instead of the counter this will solve the problem. I am looking into it.


Thanks and Regards,
David Brainard Sounthiraraj.

> Data Scroller doesnt honor dynamic rowclasses during pagination
> ---------------------------------------------------------------
>
>                 Key: TOMAHAWK-1133
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1133
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Data Scroller
>         Environment: Myfaces 1.1.5, Tomahawk 1.1.7snapshot, Tomahawk 1.1.6, Tomcat 6.0
>            Reporter: David Brainard
>
> While using a data scroller with datatable if we specify the rowclasses dynamically(through value binding) only the first page gets the rowclasses assigned properly . When we try to do pagination and go to other page the same rowclasses which were used in the first page repeats i.e the rowclasses doesnt get assigned properly.
> for e.g;  if i have a tag defined like this
>                        <t:dataTable id="myDetailDataTable" var="row"
> 			value="#{testBean.dataList}" columnClasses="#{testBean.styleClass}"
> 			headerClass="headerClass" footerClass="footerClass"
> 			rowClasses="#{testBean.rowClass}" styleClass="dataTable" rows="3" >
> and my rowclass returns something like this
>        public String getRowClass() {
> 		return "rowOdd,rowOdd,rowEven,rowEven,rowEven,rowOdd";
> 	}
> in first page the generated rowclasses are correct which is as follws:
>             
>              1st row:rowOdd, 
>               2st row:rowOdd,
>              3st row: rowEven
> but when i navigate to next page the rowclasses assignment remains the same as first page. 
>             1st row:rowOdd, 
>               2st row:rowOdd,
>              3st row: rowEven
> but it should be as follows:
>              1st row:rowEven, 
>               2st row:rowEven,
>              3st row: rowOdd
>                  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1133) Data Scroller doesnt honor dynamic rowclasses during pagination

Posted by "Zdenek Sochor (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12535578 ] 

Zdenek Sochor commented on TOMAHAWK-1133:
-----------------------------------------

Hi David,
  as you quoted: "until we reach the end"
~end of rendered html table.

RI doesn't count with paginating.

If your expansion of functionality was ever commited, it would mean breaking a lot of pages for us, other devs.

Scenario which would demonstrate it is having 2 alternating row classes with distinct background colors AND having odd number of rows per page.
I can't imagine users of applications to get used to having so different color coded pages.
Even worse case would be when using AJAX-based refreshing of the table.

Best regards,
  Zdenek

> Data Scroller doesnt honor dynamic rowclasses during pagination
> ---------------------------------------------------------------
>
>                 Key: TOMAHAWK-1133
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1133
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Data Scroller
>         Environment: Myfaces 1.1.5, Tomahawk 1.1.7snapshot, Tomahawk 1.1.6, Tomcat 6.0
>            Reporter: David Brainard
>
> While using a data scroller with datatable if we specify the rowclasses dynamically(through value binding) only the first page gets the rowclasses assigned properly . When we try to do pagination and go to other page the same rowclasses which were used in the first page repeats i.e the rowclasses doesnt get assigned properly.
> for e.g;  if i have a tag defined like this
>                        <t:dataTable id="myDetailDataTable" var="row"
> 			value="#{testBean.dataList}" columnClasses="#{testBean.styleClass}"
> 			headerClass="headerClass" footerClass="footerClass"
> 			rowClasses="#{testBean.rowClass}" styleClass="dataTable" rows="3" >
> and my rowclass returns something like this
>        public String getRowClass() {
> 		return "rowOdd,rowOdd,rowEven,rowEven,rowEven,rowOdd";
> 	}
> in first page the generated rowclasses are correct which is as follws:
>             
>              1st row:rowOdd, 
>               2st row:rowOdd,
>              3st row: rowEven
> but when i navigate to next page the rowclasses assignment remains the same as first page. 
>             1st row:rowOdd, 
>               2st row:rowOdd,
>              3st row: rowEven
> but it should be as follows:
>              1st row:rowEven, 
>               2st row:rowEven,
>              3st row: rowOdd
>                  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1133) Data Scroller doesnt honor dynamic rowclasses during pagination

Posted by "Zdenek Sochor (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12535547 ] 

Zdenek Sochor commented on TOMAHAWK-1133:
-----------------------------------------

Hi David,
  this behaviour is NOT a bug.

RowClasses attribute is property of HtmlDataTable, not DataScroller and this is from API doc:
----
getRowClasses

public java.lang.String getRowClasses()

    Return the value of the rowClasses property.

    Contents: Comma-delimited list of CSS style classes that will be applied to the rows of this table. A space separated list of classes may also be specified for any individual row. Thes styles are applied, in turn, to each row in the table. For example, if the list has two elements, the first style class in the list is applied to the first row, the second to the second row, the first to the third row, the second to the fourth row, etc. In other words, we keep iterating through the list until we reach the end, and then we start at the beginning again. 
----

It means that rowClasses are relative to top of rendered table, not relative to start of data, your asked behaviour is something against ways of RI.

IF you want your behavior in rendering, you have to rework your dynamic styles list generation.
You have to shift elements by (first % size), 
where first is index of first row in resulting table (you can get it by valueBinding first attribute of datatable) 
and size is number of elements in your list.
But you must be prepared for performance hit this way.

Best regards,
  Zdenek
  

> Data Scroller doesnt honor dynamic rowclasses during pagination
> ---------------------------------------------------------------
>
>                 Key: TOMAHAWK-1133
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1133
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Data Scroller
>         Environment: Myfaces 1.1.5, Tomahawk 1.1.7snapshot, Tomahawk 1.1.6, Tomcat 6.0
>            Reporter: David Brainard
>
> While using a data scroller with datatable if we specify the rowclasses dynamically(through value binding) only the first page gets the rowclasses assigned properly . When we try to do pagination and go to other page the same rowclasses which were used in the first page repeats i.e the rowclasses doesnt get assigned properly.
> for e.g;  if i have a tag defined like this
>                        <t:dataTable id="myDetailDataTable" var="row"
> 			value="#{testBean.dataList}" columnClasses="#{testBean.styleClass}"
> 			headerClass="headerClass" footerClass="footerClass"
> 			rowClasses="#{testBean.rowClass}" styleClass="dataTable" rows="3" >
> and my rowclass returns something like this
>        public String getRowClass() {
> 		return "rowOdd,rowOdd,rowEven,rowEven,rowEven,rowOdd";
> 	}
> in first page the generated rowclasses are correct which is as follws:
>             
>              1st row:rowOdd, 
>               2st row:rowOdd,
>              3st row: rowEven
> but when i navigate to next page the rowclasses assignment remains the same as first page. 
>             1st row:rowOdd, 
>               2st row:rowOdd,
>              3st row: rowEven
> but it should be as follows:
>              1st row:rowEven, 
>               2st row:rowEven,
>              3st row: rowOdd
>                  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.