Hummm ... Sorry every one, don't read what I've wrote in my previous messages
... Thinks I can't do or say intelligent things yesterday. Mathias gave a
solution in a previous message and it works well :
>>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>
Sorry again and thank you Mathias.
Clément (ashamed).
-----Message d'origine-----
De : Clément Maignien
Envoyé : lundi 8 août 2005 15:10
À : MyFaces Discussion
Objet : RE : RE : RE : Jump to given page with x:dataTable
Thanks Mathias but sorry I don't see how binding the dataTable component could
help me computing the first property value. Could you please tell me more ? The
way I thought is to bind the dataTable.rows (number of rows displayed) property
and the dataScroller.pageIndexVar (index of the displayed page of data) in my
bean and then computing the first value that way : myBean.firstRowToDisplay =
myBean.dataTable_rows * (myBean.dataScroller_pageIndexVar - 1). But, another
problem comes : when I am going to update this value ? I really don't know ...
Because the scrolling process is made by facets in the dataScroller component :
<x:dataScroller id="scroll" for="stockdatatable" ... <f:facet name="first" >
<x:graphicImage value="../images/arrow-first.gif" border="0"/> </f:facet>
<f:facet name="last">
<x:graphicImage value="../images/arrow-last.gif" border="0"/> </f:facet>
<f:facet name="previous">
<x:graphicImage value="../images/arrow-previous.gif" border="0"/> </f:facet>
<f:facet name="next">
<x:graphicImage value="../images/arrow-next.gif" border="0"/> </f:facet>
<f:facet name="fastforward">
<x:graphicImage value="../images/arrow-ff.gif" border="0"/> </f:facet>
<f:facet name="fastrewind">
<x:graphicImage value="../images/arrow-fr.gif" border="0"/> </f:facet>
</x:dataScroller>
As a consequence, I'm unable to associate an action or an actionListener that
would update the "first" value when one of the scroller buttons is clicked ...
I'm sure there is a way to do this but still don't know how ... Did someone did
it ? Thanks, Clément.
-----Message d'origine-----
De : Mathias Broekelmann [mailto:[EMAIL PROTECTED]
Envoyé : lundi 8 août 2005 13:32
À : MyFaces Discussion
Objet : Re: RE : RE : Jump to given page with x:dataTable
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:[EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]
>>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
>
>