You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Trevor Griffiths <tg...@liveworld.com> on 2005/08/09 18:11:56 UTC

Help with DataScroller

Hi,

I'm somewhat of a newbie with JSF and  I'm attempting to use the data
scroller with a data table.

I've tried to set a jsp page up in the same way as the example.

When the table has more then 10 entries the pagination widget displays
correctly.
If I select the next page I end up with an empty table display (header
only). The widget still displays but the buttons simply refresh the 
existing empty page.

When I set up the jsp the only link that I could see between the table and
the scroller(s)  was the  "for" parameter which I set to the id of x:datatable

The scroller and table are a complete black box to me. I have no idea
what's going on inside (and that's the way it should be for a component).
Unfortunately, I also don't know  whether my backing  bean is supposed to
do something (couldn't find the src for an example  backing bean).
Similarly what do the other parameters  pageCountVar and
pageIndexVar  actually do? The explanation in the component definition
didn't help me.  Do I need to relate them to the table in some way?

Any help (or pointers to other documentation) would be much appreciated.

Thanks

Trev...



Re: Help with DataScroller

Posted by Trevor Griffiths <tg...@liveworld.com>.
Interesting.
  Well the backing bean was set for request scope.  I tried setting it to 
session scope but it didn't fix the problem. The symptoms remained exactly 
the same.

The first page says: "14 users found, displaying 10 users . Page 1/2"

In both cases when I select the second page the scroller status says: "10 
users found, from 11 to 10. Page 2/1"

Any use of the scroller widget changes the message to: "0 users found, 
displaying 0 users, from 1 to 0. Page 1 / 0" So it looks like the data is 
definitely being "lost" somewhere :-)

I believe that I need the backing bean to be request scoped (items can be 
added, deleted or edited from the table page), so I will "play" with the 
x:saveState component for a while. Again thanks for you response.

Trev...


At 09:41 AM 8/9/2005, you wrote:
>This might not be an issue with DataScroller or Datatable, but instead
>is just a scoping issue with your table backing data.
>
>Is your data still "there" after you process a second request?  If
>you're only accessing it in a request-scoped bean, then it's gone
>afterwards.   A quick way to check is to set the bean to
>session-scoped.   If that's the case, you'll probably want to use the
>x:saveState component to preserve your data between requests.
>
>-Mike
>
>On 8/9/05, Trevor Griffiths <tg...@liveworld.com> wrote:
> > Thanks for the quick response :-)
> >
> > That's exactly what I did. I set the rows in the data table parameter to
> > 10. I then set up a table with 14 rows of data.
> > It  correctly displays the first page of the data table. The scrollers show
> > that I have 2 pages with a total of 14 entries and It is currently
> > displaying 10/14 of the entries.  When I click to display the next page
> > (using any of the appropriate buttons or links), it refreshes to an empty
> > table showing only the header and scroller widgets.  I was expecting to see
> > the remaining four rows. Once on the second page the widget will not let me
> > return to the first page. It simply re-displays an empty table.
> > weird.
> >
> > Trev...
> >
> > At 09:18 AM 8/9/2005, you wrote:
> > > From my limited use of DataScroller, it's simply a decorator.
> > >You design as if it doesn't exist (ie, work everything through your
> > >DataTable).
> > >
> > >Then you stick a couple DataScroller components on your page to modify
> > >what's actually rendered and displayed, and add a "rows" parameter to
> > >dataTable.
> > >
> > >Here are the two datascrollers I'm using (modified from the
> > >datascroller example program in myfaces.   There's nothing to it other
> > >than this code -- no backing bean support, configuration files, or
> > >java code behind it.
> > >
> > >                         <x:dataScroller id="scroller_controls"
> > >                             for="datatable"
> > >                             fastStep="10"
> > >                             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:dataScroller>
> > >                         <x:dataScroller id="scroller_information"
> > >                     for="datatable"
> > >                     rowsCountVar="rowsCount"
> > >                     displayedRowsCountVar="displayedRowsCountVar"
> > >                     firstRowIndexVar="firstRowIndex"
> > >                     lastRowIndexVar="lastRowIndex"
> > >                     pageCountVar="pageCount"
> > >                     pageIndexVar="pageIndex"
> > >                     >
> > >                 <h:outputFormat value="{0} records found, displaying
> > >{1} records, from {2} to {3}. Page {4} / {5}" styleClass="standard" >
> > >                     <f:param value="#{rowsCount}" />
> > >                     <f:param value="#{displayedRowsCountVar}" />
> > >                     <f:param value="#{firstRowIndex}" />
> > >                     <f:param value="#{lastRowIndex}" />
> > >                     <f:param value="#{pageIndex}" />
> > >                     <f:param value="#{pageCount}" />
> > >                 </h:outputFormat>
> > >             </x:dataScroller>
> > >
> > >
> > >On 8/9/05, Trevor Griffiths <tg...@liveworld.com> wrote:
> > > > Hi,
> > > >
> > > > I'm somewhat of a newbie with JSF and  I'm attempting to use the data
> > > > scroller with a data table.
> > > >
> > > > I've tried to set a jsp page up in the same way as the example.
> > > >
> > > > When the table has more then 10 entries the pagination widget displays
> > > > correctly.
> > > > If I select the next page I end up with an empty table display (header
> > > > only). The widget still displays but the buttons simply refresh the
> > > > existing empty page.
> > > >
> > > > When I set up the jsp the only link that I could see between the 
> table and
> > > > the scroller(s)  was the  "for" parameter which I set to the id of
> > > x:datatable
> > > >
> > > > The scroller and table are a complete black box to me. I have no idea
> > > > what's going on inside (and that's the way it should be for a 
> component).
> > > > Unfortunately, I also don't know  whether my backing  bean is 
> supposed to
> > > > do something (couldn't find the src for an example  backing bean).
> > > > Similarly what do the other parameters  pageCountVar and
> > > > pageIndexVar  actually do? The explanation in the component definition
> > > > didn't help me.  Do I need to relate them to the table in some way?
> > > >
> > > > Any help (or pointers to other documentation) would be much 
> appreciated.
> > > >
> > > > Thanks
> > > >
> > > > Trev...
> > > >
> > > >
> > > >
> >
> >
> >



Re: Help with DataScroller

Posted by Mike Kienenberger <mk...@gmail.com>.
This might not be an issue with DataScroller or Datatable, but instead
is just a scoping issue with your table backing data.

Is your data still "there" after you process a second request?  If
you're only accessing it in a request-scoped bean, then it's gone
afterwards.   A quick way to check is to set the bean to
session-scoped.   If that's the case, you'll probably want to use the
x:saveState component to preserve your data between requests.

-Mike

On 8/9/05, Trevor Griffiths <tg...@liveworld.com> wrote:
> Thanks for the quick response :-)
> 
> That's exactly what I did. I set the rows in the data table parameter to
> 10. I then set up a table with 14 rows of data.
> It  correctly displays the first page of the data table. The scrollers show
> that I have 2 pages with a total of 14 entries and It is currently
> displaying 10/14 of the entries.  When I click to display the next page
> (using any of the appropriate buttons or links), it refreshes to an empty
> table showing only the header and scroller widgets.  I was expecting to see
> the remaining four rows. Once on the second page the widget will not let me
> return to the first page. It simply re-displays an empty table.
> weird.
> 
> Trev...
> 
> At 09:18 AM 8/9/2005, you wrote:
> > From my limited use of DataScroller, it's simply a decorator.
> >You design as if it doesn't exist (ie, work everything through your
> >DataTable).
> >
> >Then you stick a couple DataScroller components on your page to modify
> >what's actually rendered and displayed, and add a "rows" parameter to
> >dataTable.
> >
> >Here are the two datascrollers I'm using (modified from the
> >datascroller example program in myfaces.   There's nothing to it other
> >than this code -- no backing bean support, configuration files, or
> >java code behind it.
> >
> >                         <x:dataScroller id="scroller_controls"
> >                             for="datatable"
> >                             fastStep="10"
> >                             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:dataScroller>
> >                         <x:dataScroller id="scroller_information"
> >                     for="datatable"
> >                     rowsCountVar="rowsCount"
> >                     displayedRowsCountVar="displayedRowsCountVar"
> >                     firstRowIndexVar="firstRowIndex"
> >                     lastRowIndexVar="lastRowIndex"
> >                     pageCountVar="pageCount"
> >                     pageIndexVar="pageIndex"
> >                     >
> >                 <h:outputFormat value="{0} records found, displaying
> >{1} records, from {2} to {3}. Page {4} / {5}" styleClass="standard" >
> >                     <f:param value="#{rowsCount}" />
> >                     <f:param value="#{displayedRowsCountVar}" />
> >                     <f:param value="#{firstRowIndex}" />
> >                     <f:param value="#{lastRowIndex}" />
> >                     <f:param value="#{pageIndex}" />
> >                     <f:param value="#{pageCount}" />
> >                 </h:outputFormat>
> >             </x:dataScroller>
> >
> >
> >On 8/9/05, Trevor Griffiths <tg...@liveworld.com> wrote:
> > > Hi,
> > >
> > > I'm somewhat of a newbie with JSF and  I'm attempting to use the data
> > > scroller with a data table.
> > >
> > > I've tried to set a jsp page up in the same way as the example.
> > >
> > > When the table has more then 10 entries the pagination widget displays
> > > correctly.
> > > If I select the next page I end up with an empty table display (header
> > > only). The widget still displays but the buttons simply refresh the
> > > existing empty page.
> > >
> > > When I set up the jsp the only link that I could see between the table and
> > > the scroller(s)  was the  "for" parameter which I set to the id of
> > x:datatable
> > >
> > > The scroller and table are a complete black box to me. I have no idea
> > > what's going on inside (and that's the way it should be for a component).
> > > Unfortunately, I also don't know  whether my backing  bean is supposed to
> > > do something (couldn't find the src for an example  backing bean).
> > > Similarly what do the other parameters  pageCountVar and
> > > pageIndexVar  actually do? The explanation in the component definition
> > > didn't help me.  Do I need to relate them to the table in some way?
> > >
> > > Any help (or pointers to other documentation) would be much appreciated.
> > >
> > > Thanks
> > >
> > > Trev...
> > >
> > >
> > >
> 
> 
>

Re: Help with DataScroller

Posted by Trevor Griffiths <tg...@liveworld.com>.
Thanks for the quick response :-)

That's exactly what I did. I set the rows in the data table parameter to 
10. I then set up a table with 14 rows of data.
It  correctly displays the first page of the data table. The scrollers show 
that I have 2 pages with a total of 14 entries and It is currently 
displaying 10/14 of the entries.  When I click to display the next page 
(using any of the appropriate buttons or links), it refreshes to an empty 
table showing only the header and scroller widgets.  I was expecting to see 
the remaining four rows. Once on the second page the widget will not let me 
return to the first page. It simply re-displays an empty table.
weird.

Trev...

At 09:18 AM 8/9/2005, you wrote:
> From my limited use of DataScroller, it's simply a decorator.
>You design as if it doesn't exist (ie, work everything through your 
>DataTable).
>
>Then you stick a couple DataScroller components on your page to modify
>what's actually rendered and displayed, and add a "rows" parameter to
>dataTable.
>
>Here are the two datascrollers I'm using (modified from the
>datascroller example program in myfaces.   There's nothing to it other
>than this code -- no backing bean support, configuration files, or
>java code behind it.
>
>                         <x:dataScroller id="scroller_controls"
>                             for="datatable"
>                             fastStep="10"
>                             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:dataScroller>
>                         <x:dataScroller id="scroller_information"
>                     for="datatable"
>                     rowsCountVar="rowsCount"
>                     displayedRowsCountVar="displayedRowsCountVar"
>                     firstRowIndexVar="firstRowIndex"
>                     lastRowIndexVar="lastRowIndex"
>                     pageCountVar="pageCount"
>                     pageIndexVar="pageIndex"
>                     >
>                 <h:outputFormat value="{0} records found, displaying
>{1} records, from {2} to {3}. Page {4} / {5}" styleClass="standard" >
>                     <f:param value="#{rowsCount}" />
>                     <f:param value="#{displayedRowsCountVar}" />
>                     <f:param value="#{firstRowIndex}" />
>                     <f:param value="#{lastRowIndex}" />
>                     <f:param value="#{pageIndex}" />
>                     <f:param value="#{pageCount}" />
>                 </h:outputFormat>
>             </x:dataScroller>
>
>
>On 8/9/05, Trevor Griffiths <tg...@liveworld.com> wrote:
> > Hi,
> >
> > I'm somewhat of a newbie with JSF and  I'm attempting to use the data
> > scroller with a data table.
> >
> > I've tried to set a jsp page up in the same way as the example.
> >
> > When the table has more then 10 entries the pagination widget displays
> > correctly.
> > If I select the next page I end up with an empty table display (header
> > only). The widget still displays but the buttons simply refresh the
> > existing empty page.
> >
> > When I set up the jsp the only link that I could see between the table and
> > the scroller(s)  was the  "for" parameter which I set to the id of 
> x:datatable
> >
> > The scroller and table are a complete black box to me. I have no idea
> > what's going on inside (and that's the way it should be for a component).
> > Unfortunately, I also don't know  whether my backing  bean is supposed to
> > do something (couldn't find the src for an example  backing bean).
> > Similarly what do the other parameters  pageCountVar and
> > pageIndexVar  actually do? The explanation in the component definition
> > didn't help me.  Do I need to relate them to the table in some way?
> >
> > Any help (or pointers to other documentation) would be much appreciated.
> >
> > Thanks
> >
> > Trev...
> >
> >
> >



Re: Help with DataScroller

Posted by Mike Kienenberger <mk...@gmail.com>.
>From my limited use of DataScroller, it's simply a decorator.
You design as if it doesn't exist (ie, work everything through your DataTable).

Then you stick a couple DataScroller components on your page to modify
what's actually rendered and displayed, and add a "rows" parameter to
dataTable.

Here are the two datascrollers I'm using (modified from the
datascroller example program in myfaces.   There's nothing to it other
than this code -- no backing bean support, configuration files, or
java code behind it.

			<x:dataScroller id="scroller_controls"
                            for="datatable"
                            fastStep="10"
                            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:dataScroller>
			<x:dataScroller id="scroller_information"
                    for="datatable"
                    rowsCountVar="rowsCount"
                    displayedRowsCountVar="displayedRowsCountVar"
                    firstRowIndexVar="firstRowIndex"
                    lastRowIndexVar="lastRowIndex"
                    pageCountVar="pageCount"
                    pageIndexVar="pageIndex"
                    >
                <h:outputFormat value="{0} records found, displaying
{1} records, from {2} to {3}. Page {4} / {5}" styleClass="standard" >
                    <f:param value="#{rowsCount}" />
                    <f:param value="#{displayedRowsCountVar}" />
                    <f:param value="#{firstRowIndex}" />
                    <f:param value="#{lastRowIndex}" />
                    <f:param value="#{pageIndex}" />
                    <f:param value="#{pageCount}" />
                </h:outputFormat>
            </x:dataScroller>


On 8/9/05, Trevor Griffiths <tg...@liveworld.com> wrote:
> Hi,
> 
> I'm somewhat of a newbie with JSF and  I'm attempting to use the data
> scroller with a data table.
> 
> I've tried to set a jsp page up in the same way as the example.
> 
> When the table has more then 10 entries the pagination widget displays
> correctly.
> If I select the next page I end up with an empty table display (header
> only). The widget still displays but the buttons simply refresh the
> existing empty page.
> 
> When I set up the jsp the only link that I could see between the table and
> the scroller(s)  was the  "for" parameter which I set to the id of x:datatable
> 
> The scroller and table are a complete black box to me. I have no idea
> what's going on inside (and that's the way it should be for a component).
> Unfortunately, I also don't know  whether my backing  bean is supposed to
> do something (couldn't find the src for an example  backing bean).
> Similarly what do the other parameters  pageCountVar and
> pageIndexVar  actually do? The explanation in the component definition
> didn't help me.  Do I need to relate them to the table in some way?
> 
> Any help (or pointers to other documentation) would be much appreciated.
> 
> Thanks
> 
> Trev...
> 
> 
>