File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Facing problems with x:dataTable and x:dataScroller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Facing problems with x:dataTable and x:dataScroller" Watch "Facing problems with x:dataTable and x:dataScroller" New topic
Author

Facing problems with x:dataTable and x:dataScroller

sridhar panini
Greenhorn

Joined: Sep 13, 2005
Posts: 9
hi,
i am using the myfaces extensions.
I have a dynamic datatable and that works fine but when I use the dataScroller for navigating to the next page. It gives me the same data again and again.
its not getting the data from the model.

can any body suggest me what could be the problem.
help required, very urgent.
Prem Khan
Ranch Hand

Joined: May 30, 2005
Posts: 189
could you post some code, it would be easyer to help you
sridhar panini
Greenhorn

Joined: Sep 13, 2005
Posts: 9
Here is my JSF code.

<t anelGrid columns="1" border="1" bgcolor="pink" width="100%">
<h utputText value="Search Results" styleClass="standard" />
<x ataTable id="datas"
styleClass="standard"
border="1"
var="country"
value="#{searchResultModel.data}"
sortColumn="#{searchResultModel.sort}"
sortAscending="#{searchResultModel.ascending}"
preserveDataModel="true"
preserveSort="true"
rows="20"
rowIndexVar="rowindex"
rowCountVar="rowcount"
binding="#{dataSelector.dataTable}">

<x:columns value="#{searchResultModel.columnHeaders}" var="column">
<f:facet name="header">
<h anelGroup>
<x:commandSortHeader columnName="#{column}" arrow="true">
<h utputText value="#{column} " />
</x:commandSortHeader>
</h anelGroup>
</f:facet>
<h utputText value="#{searchResultModel.columnValue}" />
</x:columns>
</x ataTable>
</t anelGrid>

<h anelGrid columns="1" styleClass="scrollerTable2" columnClasses="standardTable_ColumnCentered" >
<x ataScroller id="scroll_1"
for="datas"
fastStep="5"
pageCountVar="pageCount"
pageIndexVar="pageIndex"
styleClass="scroller"
paginator="true"
paginatorMaxPages="9"
paginatorTableClass="paginator"
paginatorActiveColumnStyle="font-weight:bold;">

<f:facet name="first" >
<h:graphicImage url="/images/arrow-first.gif" border="1" />
</f:facet>
<f:facet name="last">
<h:graphicImage url="/images/arrow-last.gif" border="1" />
</f:facet>
<f:facet name="previous">
<h:graphicImage url="/images/arrow-previous.gif" border="1" />
</f:facet>
<f:facet name="next">
<h:graphicImage url="/images/arrow-next.gif" border="1" />
</f:facet>
<f:facet name="fastforward">
<h:graphicImage url="/images/arrow-ff.gif" border="1" />
</f:facet>
<f:facet name="fastrewind">
<h:graphicImage url="/images/arrow-fr.gif" border="1" />
</f:facet>
</x ataScroller>
</h anelGrid>
sridhar panini
Greenhorn

Joined: Sep 13, 2005
Posts: 9
Here is the code:
I have DataModel's for headers and data. I have getData and getColoumnHeaders() methods to access these Models and a getColumnValue() method to get the data for the dynamic column being selected from the JSP.
I use reflection to get the getXXX() methods from the actual DATA model i.e., the VALUE OBJECT and invoke that method when ever I want to get the value of a particular variable.

Here is my getColumnValue() method.
Now the PROBLEM HERE IS the dataScroller uses the same data for the rest of PAGES instead of the NEW DATA to be displayed.
public String getColumnValue() {

String columnValue = null;
DataModel headerModel = getColumnHeaders();
if (headerModel.isRowAvailable()) {
String column = (String)headerModel.getRowData();
DataModel beanDataModel = getData();
if (beanDataModel.isRowAvailable()) {
SearchDataModelBean searchData = (SearchDataModelBean) beanDataModel.getRowData();
System.out.println(searchData);
try {
Method getMethod = (Method) reflectionMap.get(headerColumnMap.get(column));
if (getMethod != null) {
columnValue = (String) getMethod.invoke(searchData, null);
}
} catch(Exception e) {
e.printStackTrace();
}
}
//System.out.println(columnValue);
}
return columnValue;
}
HELP REQUIRED! VERY URGENT.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Facing problems with x:dataTable and x:dataScroller