Alexandre, can you specify some more details about what you're trying to do?


Cosma

2006/7/4, Alexandre Jaquet <[EMAIL PROTECTED]>:
I only need to work with :

datatable.setRowIndex (5);
datatable.getRowData();

when I want to extend the component ?

Thanks for your time passed ro responding :)

Cagatay Civici wrote:
> Hi,
>
> As Cosma explained before, all the control is done using a datamodel,
> even if you bind a list object as the value of a uidata, it is wrapped
> as a ListDataModel object. For example when you call
>
> datatable.setRowIndex (5);
> datatable.getRowData();
>
> At UIData, it leads to
>
> getDataModel().setRowIndex(5);
> getDataModel().getRowData();
>
> At DataModel it finally refers to;
>
> setRowIndex(5);  // sets row index
> getRowData();   //finally returns list.get(rowIndex);
>
> Cagatay
>
>
>
> On 7/4/06, *Alexandre Jaquet* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Well Cosma first thanks for your explanation, if I understand
>     well, all
>     components have to extend UIData and we can set to every components a
>     dataModel?
>
>
>     Cosma Colanicchia wrote:
>     > Hi Alexandre,
>     >
>     > it's simple, JSF defines a DataModel class that is used by UIData
>     > componentes (like the data table). Note that it is allowed the
>     usage
>     > of some other types (for example java.util.List) because DataModel
>     > implementations that wraps it are available automatically picked.
>     >
>     > Basically, the datatable will initially ask your DataModel size
>     using
>     > getDatasetSize(), then ask rows as need one by one calling:
>     >
>     > - isRowAvailable(index) to see if a particular index maps to an
>     actual
>     > row
>     > - setRowIndex(index) to make that index current
>     > - getRowData() to get the object with the data of the current
>     row index
>     >
>     > So, if you need more control, you can implement your DataModel
>     object
>     > (extending the JSF base class) and specify it as the datatable's
>     value
>     > attribute.
>     >
>     > This way you can, for example, implement the getDatasetSize()
>     doing a
>     > SELECT COUNT on the database and query the db only for a limited set
>     > of rows in getRowData(), instead of loading an entire table in
>     memory
>     > when creating the view.
>     >
>     >
>     > Hope this helps
>     > Cosma
>     >
>     > 2006/7/4, Alexandre Jaquet <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>:
>     >> Hi,
>     >>
>     >> I want to understand how work DataTable any good documentation
>     ? I want
>     >> to understand the cars-demo example :
>     >> http://wiki.apache.org/myfaces/WorkingWithLargeTables
>     <http://wiki.apache.org/myfaces/WorkingWithLargeTables>
>     >>
>     >> regards
>     >>
>     >
>
>


Reply via email to