You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Marcus Bond <ma...@hotmail.com> on 2006/12/11 11:10:42 UTC

tr:table & paging

From what I can gather, in Trinidad the total number of records in a table 
is automatically 'known' by the  number of rows in the model. However, what 
if you don't want to fetch the whole set of data from the database and would 
prefer to only fetch the required rows from the database for each page?

I only want to query for a small number of records (1 page) at a time but 
need some way of informing the table component that there are in fact a lot 
more records in the database.
This would require setting a variable that represents the total number of 
rows available from the database, but there doesn't appear any longer to be 
this facility.

Is there a straightforward way of doing this? (eg: like the dataScroller in 
tomahawk)

thanks,
Marcus

_________________________________________________________________
It's Hotmail's 10th Birthday! Come and play Pass the Parcel 
http://www.msnpasstheparcel.com


Re: tr:table & pagi

Posted by Adam Winer <aw...@gmail.com>.
Yes, that's it.

-- Adam


On 12/20/06, Marcus Bond <ma...@hotmail.com> wrote:
> Thanks for the reply,
> So is the way of doing this to extend a dataModel class and implement my own
> getRowCount() method?
>
>
> >From: "Adam Winer" <aw...@gmail.com>
> >Reply-To: adffaces-user@incubator.apache.org
> >To: adffaces-user@incubator.apache.org
> >Subject: Re: tr:table & pagin
> >Date: Mon, 11 Dec 2006 08:45:59 -0800
> >
> >On 12/11/06, Marcus Bond <ma...@hotmail.com> wrote:
> >>From what I can gather, in Trinidad the total number of records in a table
> >>is automatically 'known' by the  number of rows in the model. However,
> >>what
> >>if you don't want to fetch the whole set of data from the database and
> >>would
> >>prefer to only fetch the required rows from the database for each page?
> >
> >No, not the case.  Just like in Tomahawk and with h:dataTable,
> >we support the DataModel API.  If you don't know how many rows
> >there are, then return -1 from getRowCount().  The only requirement -
> >which applies to all users of the JSF DataModel API - is that if
> >someone calls setRowIndex(...), isRowAvailable() has to figure
> >out if that row really exists.
> >
> >The Trinidad CollectionModel API extends DataModel to add support
> >for sorting and identifying-rows-by-keys-instead-of-indices - but
> >the same rules apply.  So you could extend CollectionModel instead
> >of DataModel if you want those add-on features, but we support
> >both DataModel and CollectionModel.
> >
> >-- Adam
> >
> >>
> >>I only want to query for a small number of records (1 page) at a time but
> >>need some way of informing the table component that there are in fact a
> >>lot
> >>more records in the database.
> >>This would require setting a variable that represents the total number of
> >>rows available from the database, but there doesn't appear any longer to
> >>be
> >>this facility.
> >>
> >>Is there a straightforward way of doing this? (eg: like the dataScroller
> >>in
> >>tomahawk)
> >>
> >>thanks,
> >>Marcus
> >>
> >>_________________________________________________________________
> >>It's Hotmail's 10th Birthday! Come and play Pass the Parcel
> >>http://www.msnpasstheparcel.com
> >>
> >>
>
> _________________________________________________________________
> It's Hotmail's 10th Birthday! Come and play Pass the Parcel
> http://www.msnpasstheparcel.com
>
>

Re: tr:table & pagin

Posted by Marcus Bond <ma...@hotmail.com>.
Thanks for the reply,
So is the way of doing this to extend a dataModel class and implement my own 
getRowCount() method?


>From: "Adam Winer" <aw...@gmail.com>
>Reply-To: adffaces-user@incubator.apache.org
>To: adffaces-user@incubator.apache.org
>Subject: Re: tr:table & pagin
>Date: Mon, 11 Dec 2006 08:45:59 -0800
>
>On 12/11/06, Marcus Bond <ma...@hotmail.com> wrote:
>>>From what I can gather, in Trinidad the total number of records in a table
>>is automatically 'known' by the  number of rows in the model. However, 
>>what
>>if you don't want to fetch the whole set of data from the database and 
>>would
>>prefer to only fetch the required rows from the database for each page?
>
>No, not the case.  Just like in Tomahawk and with h:dataTable,
>we support the DataModel API.  If you don't know how many rows
>there are, then return -1 from getRowCount().  The only requirement -
>which applies to all users of the JSF DataModel API - is that if
>someone calls setRowIndex(...), isRowAvailable() has to figure
>out if that row really exists.
>
>The Trinidad CollectionModel API extends DataModel to add support
>for sorting and identifying-rows-by-keys-instead-of-indices - but
>the same rules apply.  So you could extend CollectionModel instead
>of DataModel if you want those add-on features, but we support
>both DataModel and CollectionModel.
>
>-- Adam
>
>>
>>I only want to query for a small number of records (1 page) at a time but
>>need some way of informing the table component that there are in fact a 
>>lot
>>more records in the database.
>>This would require setting a variable that represents the total number of
>>rows available from the database, but there doesn't appear any longer to 
>>be
>>this facility.
>>
>>Is there a straightforward way of doing this? (eg: like the dataScroller 
>>in
>>tomahawk)
>>
>>thanks,
>>Marcus
>>
>>_________________________________________________________________
>>It's Hotmail's 10th Birthday! Come and play Pass the Parcel
>>http://www.msnpasstheparcel.com
>>
>>

_________________________________________________________________
It's Hotmail's 10th Birthday! Come and play Pass the Parcel  
http://www.msnpasstheparcel.com


Re: tr:table & pagin

Posted by Adam Winer <aw...@gmail.com>.
On 12/11/06, Marcus Bond <ma...@hotmail.com> wrote:
> From what I can gather, in Trinidad the total number of records in a table
> is automatically 'known' by the  number of rows in the model. However, what
> if you don't want to fetch the whole set of data from the database and would
> prefer to only fetch the required rows from the database for each page?

No, not the case.  Just like in Tomahawk and with h:dataTable,
we support the DataModel API.  If you don't know how many rows
there are, then return -1 from getRowCount().  The only requirement -
which applies to all users of the JSF DataModel API - is that if
someone calls setRowIndex(...), isRowAvailable() has to figure
out if that row really exists.

The Trinidad CollectionModel API extends DataModel to add support
for sorting and identifying-rows-by-keys-instead-of-indices - but
the same rules apply.  So you could extend CollectionModel instead
of DataModel if you want those add-on features, but we support
both DataModel and CollectionModel.

-- Adam

>
> I only want to query for a small number of records (1 page) at a time but
> need some way of informing the table component that there are in fact a lot
> more records in the database.
> This would require setting a variable that represents the total number of
> rows available from the database, but there doesn't appear any longer to be
> this facility.
>
> Is there a straightforward way of doing this? (eg: like the dataScroller in
> tomahawk)
>
> thanks,
> Marcus
>
> _________________________________________________________________
> It's Hotmail's 10th Birthday! Come and play Pass the Parcel
> http://www.msnpasstheparcel.com
>
>