[
https://jira.jboss.org/jira/browse/RF-1133?page=com.atlassian.jira.plugin...
]
Aladdin El-Nattar commented on RF-1133:
---------------------------------------
Not sure if this warrants a new issue to be created or not, but
HtmlDatascroller.setPage(int) doesn't seem to work in 3.2.1.GA.
I tried it in 3.2.0 and it works. The code is quite simple. Here is my xhtml snippet:
<h:dataTable id="contents-table"
value="#{action.contents.contentList}" var="item"
rows="#{action.contents.itemsPerPage}"
binding="#{action.contents.dataTable}">
...
</h:dataTable>
<a4j:outputPanel id="pagination-panel" layout="block">
<rich:datascroller id="pagination-scroller" for="contents-table"
renderIfSinglePage="false"
binding="#{action.contents.scroller}" maxPages="20">
<f:facet name="first">
<h:outputText value="First" />
</f:facet>
<f:facet name="last">
<h:outputText value="Last" />
</f:facet>
</rich:datascroller>
</a4j:outputPanel>
Here is my code that is triggered by a different component with
reRender="contents-table, pagination-scroller":
@Name(value="action.contents)
public class ...
...
private HtmlDataTable dataTable; (getter and setter exist)
private HtmlDatascroller scroller; (getter and setter exist)
...
@Observer
public void handleNewDataEvent() {
// Change content in table
populateContentList();
logger.info("************ PAGE WAS " + this.scroller.getPage());
this.scroller.setPage(1);
logger.info("************ PAGE IS " + this.scroller.getPage());
}
Conditions:
- Table contains 100 rows
- Max rows per page is 2
Use Case:
- Datascroller shows many pages
- Click on page 2
- Use different component to trigger page reset and populate table with new data
Result in logs is:
INFO [...] ************ PAGE WAS 2
INFO [...] ************ PAGE IS 2
Page should have been set to 1. Why is it still set to 2? It's as if setPage(int) is
not doing anything.
In 3.2.0.GA I get this:
INFO [...] ************ PAGE WAS 2
INFO [...] ************ PAGE IS 1
and everything works fine.
rich:datascroller does not reset when data model is changed
-----------------------------------------------------------
Key: RF-1133
URL:
https://jira.jboss.org/jira/browse/RF-1133
Project: RichFaces
Issue Type: Bug
Components: docs updated
Affects Versions: 3.1.1
Reporter: henrik lindberg
Assignee: Tsikhon Kuprevich
Priority: Critical
Fix For: 3.2.0
When the datamodel for a rich:dataTable is replaced with a new model the
rich:datascroller still remembers its old page index.
Now, in order to make it work, I have to look up the UIData and set the index to 0 when I
change the datamodel.
I would expect it to either be set to 0, or to the value of "first" attribute
in the rich:dataTable when its model is changed.
This problem is blocking me from releasing my application - I have *many* affected
datascrollers and doing the following for all of them would not be fun...
// how I reset the first value - perhaps there are beter ways to do this
String id = "spaceForm:content_list";
UIComponent comp = FacesContext.getCurrentInstance().getViewRoot().findComponent( id
);
if(comp == null)
throw new IllegalArgumentException("Can not find component with id =
'"+id+"'");
if(!(comp instanceof UIData))
throw new IllegalArgumentException("Id does not refer to a UIData
instance");
UIData uidata = (UIData)comp;
uidata.setFirst(0);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira