You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Clément Maignien <c....@edic-syliance.com> on 2005/08/08 12:09:46 UTC

RE : RE : Jump to given page with x:dataTable

Thanks for the info Mathias.
Despite I don't get the ClassCastException anymore, the right page of my dataTable isn't displayed.
I have initted the attribute value of my bean to new Integer(0). Then, by displaying its value through the pages scrolling, I see that it keeps its 0 value (normal as I also saw that the setter of the attribute is never called).
I can't imagine that it is the programmer's work to update this attribute value ... no ? And if so, where and how ? 

Regards, Clément.

-----Message d'origine-----
De : Mathias Broekelmann [mailto:mbroekelmann@PSI.DE] 
Envoyé : lundi 8 août 2005 10:47
À : MyFaces Discussion
Objet : Re: RE : Jump to given page with x:dataTable


Take a look into the javadoc for UIData. It´s just the integer value of 
the zero based row index for the first row of the table. The instance 
should be of java.lang.Integer.

Regards,
Mathias

Clément Maignien schrieb:
> Hi,
> I also need this possibility, and enjoyed to see that it was possible 
> to do it. However, what I tried doesn't work. Like Mathias said, I try 
> to use the "first" property of the dataTable, binding it to a backing 
> bean attribute. The problem is that I have a ClassCastException when 
> accessing it :
> 
> 10:05:55,118 INFO  [STDOUT] java.lang.ClassCastException: fr.edic.cormag.view.datastructure.StockData
> 10:05:55,118 INFO  [STDOUT] 	at javax.faces.component.UIData.getFirst(UIData.java:723)
> 10:05:55,180 INFO  [STDOUT] 	at org.apache.myfaces.component.html.ext.HtmlDataTable.getFirst(HtmlDataTable.java:324)".
> 
> I thought that the type of the backing bean attribute for the "first" 
> property should be the same as the data row displayed in the dataTable 
> (in my case : StockData), but it seems not ...
> 
> So my question is : what is the type of the backing bean attribute to 
> bind the "first" property of a dataTable component ?
> 
> Thanks,
> Clément.
> 
> -----Message d'origine-----
> De : Mathias Broekelmann [mailto:mbroekelmann@PSI.DE]
> Envoyé : mardi 2 août 2005 10:20
> À : MyFaces Discussion
> Objet : Re: Jump to given page with x:dataTable
> 
> 
> When the action of your button is invoked get the current value of the
> first property of the datatable. You can use binding for this. You have to store this value somewhere and by using a value binding for 
> the first property of the datatable it is possible to provide an inital 
> value (your stored value) for that:
> 
> <x:datatable ... first="#{data.first}" binding="#{data.datatable}"> 
> </x:datatable>
> 
> Regards,
> Mathias
> 
> Michael Hartman schrieb:
> 
>>I have a page displaying data using both the x:dataTable and
>>x:dataScroller tags.  I'd like to know if it is possible when I visit 
>>the page that it "jump" or remember to goto a particular page, say 
>>page 2 instead of page 1.
>>
>>For example, I have 100 items to display with a pagesize of 10 (i.e. rows =
>>10).  That would give me 10 pages to scroll through (100 / 10 = 10).    From
>>this page a user may click on an item in order to the view another
>>page with another table displaying details.  From the details page 
>>they'd like to go back to the summary page and return to viewing the 
>>same page there were on.  The users cannot use the browser's back 
>>button.  The back function is current a h:commandLink button tied to a 
>>navigation-rule that points to the summary page.  When they click on 
>>it they go back but the summary dataTable jumps back to the first 
>>page.
>>
>>I am using the nightly build from 31-Jul-2005.
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam?  Yahoo! Mail has the best spam protection around 
>>http://mail.yahoo.com


Re: RE : RE : Jump to given page with x:dataTable

Posted by Mathias Broekelmann <mb...@PSI.DE>.
Most of the value bindings in myfaces are readonly. I´m not sure what 
the spec says about this but you are right it is better to make those 
value bindings read/write.

One way I see is to use a binding for the datatable and get the first 
value from there.

Regards,
Mathias

Clément Maignien schrieb:
> Thanks for the info Mathias.
> Despite I don't get the ClassCastException anymore, the right page of my dataTable isn't displayed.
> I have initted the attribute value of my bean to new Integer(0). Then, by displaying its value through the pages scrolling, I see that it keeps its 0 value (normal as I also saw that the setter of the attribute is never called).
> I can't imagine that it is the programmer's work to update this attribute value ... no ? And if so, where and how ? 
> 
> Regards, Clément.
> 
> -----Message d'origine-----
> De : Mathias Broekelmann [mailto:mbroekelmann@PSI.DE] 
> Envoyé : lundi 8 août 2005 10:47
> À : MyFaces Discussion
> Objet : Re: RE : Jump to given page with x:dataTable
> 
> 
> Take a look into the javadoc for UIData. It´s just the integer value of 
> the zero based row index for the first row of the table. The instance 
> should be of java.lang.Integer.
> 
> Regards,
> Mathias
> 
> Clément Maignien schrieb:
> 
>>Hi,
>>I also need this possibility, and enjoyed to see that it was possible 
>>to do it. However, what I tried doesn't work. Like Mathias said, I try 
>>to use the "first" property of the dataTable, binding it to a backing 
>>bean attribute. The problem is that I have a ClassCastException when 
>>accessing it :
>>
>>10:05:55,118 INFO  [STDOUT] java.lang.ClassCastException: fr.edic.cormag.view.datastructure.StockData
>>10:05:55,118 INFO  [STDOUT] 	at javax.faces.component.UIData.getFirst(UIData.java:723)
>>10:05:55,180 INFO  [STDOUT] 	at org.apache.myfaces.component.html.ext.HtmlDataTable.getFirst(HtmlDataTable.java:324)".
>>
>>I thought that the type of the backing bean attribute for the "first" 
>>property should be the same as the data row displayed in the dataTable 
>>(in my case : StockData), but it seems not ...
>>
>>So my question is : what is the type of the backing bean attribute to 
>>bind the "first" property of a dataTable component ?
>>
>>Thanks,
>>Clément.
>>
>>-----Message d'origine-----
>>De : Mathias Broekelmann [mailto:mbroekelmann@PSI.DE]
>>Envoyé : mardi 2 août 2005 10:20
>>À : MyFaces Discussion
>>Objet : Re: Jump to given page with x:dataTable
>>
>>
>>When the action of your button is invoked get the current value of the
>>first property of the datatable. You can use binding for this. You have to store this value somewhere and by using a value binding for 
>>the first property of the datatable it is possible to provide an inital 
>>value (your stored value) for that:
>>
>><x:datatable ... first="#{data.first}" binding="#{data.datatable}"> 
>></x:datatable>
>>
>>Regards,
>>Mathias
>>
>>Michael Hartman schrieb:
>>
>>
>>>I have a page displaying data using both the x:dataTable and
>>>x:dataScroller tags.  I'd like to know if it is possible when I visit 
>>>the page that it "jump" or remember to goto a particular page, say 
>>>page 2 instead of page 1.
>>>
>>>For example, I have 100 items to display with a pagesize of 10 (i.e. rows =
>>>10).  That would give me 10 pages to scroll through (100 / 10 = 10).    From
>>>this page a user may click on an item in order to the view another
>>>page with another table displaying details.  From the details page 
>>>they'd like to go back to the summary page and return to viewing the 
>>>same page there were on.  The users cannot use the browser's back 
>>>button.  The back function is current a h:commandLink button tied to a 
>>>navigation-rule that points to the summary page.  When they click on 
>>>it they go back but the summary dataTable jumps back to the first 
>>>page.
>>>
>>>I am using the nightly build from 31-Jul-2005.
>>>
>>>__________________________________________________
>>>Do You Yahoo!?
>>>Tired of spam?  Yahoo! Mail has the best spam protection around 
>>>http://mail.yahoo.com
> 
>