-
1. Re: DataScroller reset the current page
amitev Dec 5, 2007 5:07 AM (in response to maiky)Currently the datascroller. You have to reset it yourself. You can do this with binding to the datatable and call dataTable.setFirst(0)
-
2. Re: DataScroller reset the current page
mail.micke Dec 5, 2007 5:31 AM (in response to maiky)
A bit of a redundant post, but you also bind the datascroller and do:
dataScroller.getDataTable().setFirst(0);
:) -
3. Re: DataScroller reset the current page
razwed4ik Dec 24, 2007 4:09 AM (in response to maiky)Hi Guys, I have the same problem.
What do you mean with binding and call this setFirst() method. Can you give an example how to do this.
If I have code like this:
<rich:datascroller align="left" for="table" maxPages="10" />
so how i can call this methode setFirst?
Merry Christmas, bst rgrds -
4. Re: DataScroller reset the current page
mail.micke Dec 24, 2007 6:39 PM (in response to maiky)Hi,
what we mean is that you use a binding to an instance of the actual JSF ui component on the backing bean.
Here you can choose to either have a binding to the data table, or like I suggested the data scroller.
You do this by creating a property with the ui component on the backing bean like you would any other property, and then use the "binding" attribute in your xhtml/jsp markup. Really quite simple.
Then what I do is call the setFirst method in an action which creates the data the datatable is displaying.
Afraid I can't produce any code snippets now, late and on holiday. But if you need some I can digg some up for you later on.
Cheers -
5. Re: DataScroller reset the current page
razwed4ik Dec 25, 2007 5:53 AM (in response to maiky)Thanks Micke,
I think i understood, what u mean. Let you know, if I made it.
Happy holidays -
6. Re: DataScroller reset the current page
mars1412 Mar 28, 2008 6:56 AM (in response to maiky)I think the described behaviour should be default for datascroller.
I can't think of any situation when you don't want the datascroller to got to last page, when you just deleted the last item of the (previous) last page).
should we raise a feature request jira for this? -
7. Re: DataScroller reset the current page
mars1412 Mar 31, 2008 6:03 AM (in response to maiky)I just tried the workaround proposed in the other postings here.
Well, it works, but it feels very bad: This means that I must use UIDataScroller in each of my backing-beans and thus making my ejb-project dependant on the gui (richfaces libs).
does anyone know a better approach for this? -
8. Re: DataScroller reset the current page
ljunior Mar 31, 2008 7:58 AM (in response to maiky)I have a similar problem to solve. In my case I want to return to the page that the user was when he clicked the delete button. I added a scrollerListener to my dataScroller and I bind it to my backing bean. Should I use the setFirst method in this case too? Have anyone a example?
-
9. Re: DataScroller reset the current page
mars1412 Mar 31, 2008 8:40 AM (in response to maiky)Does it work with the scrollerListener?
If not, getPageCount() and setPage() might help you. -
10. Re: DataScroller reset the current page
ljunior Mar 31, 2008 10:12 AM (in response to maiky)With the scrollerListener I might retrieve the last page selected by the user. What I couldn't yet is to return to that page. I tried to use the setPage method of DataScroller, however it doesn't work. Any other idea?
My code (somethings in Portuguese...):public void scrollerListener(DataScrollerEvent evt){ System.out.println("New page: " + evt.getNewScrolVal() + " - Old page: " + evt.getOldScrolVal()); //((HtmlDatascroller)evt.getSource()).getDataTable().set paginaAnterior = evt.getNewScrolVal(); } protected void voltarPaginaAnterior(){ System.out.println("Voltando para a página: " + paginaAnterior); formDataScroller.setPage(paginaAnterior); }
-
11. Re: DataScroller reset the current page
mars1412 Mar 31, 2008 11:20 AM (in response to maiky)that works for me (to reset the page to the last one):
public void checkPages(UIDatascroller ds) { int pageCount = ds.getPageCount(); int pageIndex = ds.getPageIndex(); if (pageIndex > pageCount) { ds.setPage(UIDatascroller.LAST_FACET_NAME); } }
-
12. Re: DataScroller reset the current page
nbelaevski Mar 31, 2008 5:18 PM (in response to maiky)That's been tracked as http://jira.jboss.com/jira/browse/RF-1133
The problem should be fixed in 3.2.0, please try it -
13. Re: DataScroller reset the current page
mail.micke Aug 29, 2008 9:46 AM (in response to maiky)I'm using 3.2.1 and had to resort to the page="#{some.el}" solution. Did this problem resurface?
- micke