Nice explanation it's clear right now many thx

Cosma Colanicchia wrote:
Only some components are UIData. Think it as a set of component
"families", there are UICommand that includes commandLink and
commandButton, or UIInput with inputText and selectManyListbox, and
others.

UIData components usually display data as a list or in a tabular
format, and they are designed to get the data to display by a
DataModel object. This can be transparent to you, because writing
<t:dataTable value="#{myListBean.listData}"> will work even if the
listData property is a java.util.List, a RecordSet or an array of
objects.

This way, however, you need to load ALL your data in the list and then
pass it to the <t:dataTable>, leading to performance and memory
problems when your table is very large. To solve this problem, you can
implement a custom DataModel subclass, as I was explaining in my
previous reply, that allows you to load the records only when they're
actually displayed (think of a paged dataTable).


Cosma


2006/7/4, Alexandre Jaquet <[EMAIL PROTECTED]>:
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]>:
>> 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
>>
>> regards
>>
>




Reply via email to