You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tobias Kilian <To...@gmx.de> on 2007/09/05 09:44:33 UTC
[Trinidad] Table model update?
Hi NG!
Im using a trinidad tr:table inside my seam-application.
The Problem:
It seams, that the table model is only generated once, at the first
attempt to render the table and doesnt change afterwards. Is this
correct? I suppose it could be desired behavior, but that leads me into
trouble..
The Situation:
I have a selectionList on the left side and a tr:table at the right. I
want the tables underlying list to be one of left side's members. So the
selectItems value is #{tableInstance.selectedMaster}, while the tables
value attribute is #{tableInstance.selectedMaster.getSlaves()}" the
selectManyList has partialSubmit=true and is a trigger for the table, so
that works. I can select a master on the left and see all its slaves in
the table. However the tables model is not changing. Thats why the
table's getSelectedRowKeys() gives me wrong indices.
Question:
is their a way to tell the tr:table to refresh its underlying model? How
else could i accomplish this?
Many thanks,
Tobias Kilian
Re: [Trinidad] Table model update?
Posted by Renzo Tomaselli <re...@tecnotp.it>.
Tobias, a row list (or array) is transformed internally to a
SortableModel, but I guess it then keeps your list forever.
As an alternative, you can provide either a DataModel (JSF standard) or
a CollectionModel (Trindad specific) class instance, see related
javadoc. The former handles rows by position, so that it isn't suitable
for mutable row sets as long as you need row selection or updating.
The latter handles rows by key (and unfortunately by position as well,
this is another thread subject), so that is suitable for row sets
changing from request to request (rows are identified by unique key).
If you provide your own model, then you can change contents (e.g. rows)
from request to request, since then your model is requested to feed rows
as soon as the table component needs them. Then you can apply your cache
policies for paging, etc.
-- Renzo
Tobias Kilian wrote:
> Renzo Tomaselli schrieb:
>> Hi Tobias, I know nothing about Seam, but I had a table refresh
>> problem in the past, when my user was allowed to change colum
>> layout/composition on the fly.
>> In order to refresh the table children, I had to call:
>>
>> ((UIXTable)table).resetStampState();
>>
>> where - of course - I got the actual component through the binding
>> attribute.
>> Model contents - e.g. rows - can change happily from request to
>> request, provided that you feed the table value attribute through a
>> properly up-to-date own CollectionModel. Btw, I assume using
>> request-scoped beans here.
> Hi Renzo!
>
> Thanks for your reply!
> The binding already happens in the request scope. I have a List of
> entitys as value to the table, which contents can change, but this
> way, I dont get the model changed.
> So I need to give a CollectionModel instead ? How do I setup my own
> collectionModel? Can you give me any hints or links to that? Im pretty
> new to Trinidad, Seam and even to Java :-)
>
> Thanks,
> Tobias
>
>
Re: [Trinidad] Table model update?
Posted by Tobias Kilian <To...@gmx.de>.
Renzo Tomaselli schrieb:
> Hi Tobias, I know nothing about Seam, but I had a table refresh
> problem in the past, when my user was allowed to change colum
> layout/composition on the fly.
> In order to refresh the table children, I had to call:
>
> ((UIXTable)table).resetStampState();
>
> where - of course - I got the actual component through the binding
> attribute.
> Model contents - e.g. rows - can change happily from request to
> request, provided that you feed the table value attribute through a
> properly up-to-date own CollectionModel. Btw, I assume using
> request-scoped beans here.
Hi Renzo!
Thanks for your reply!
The binding already happens in the request scope. I have a List of
entitys as value to the table, which contents can change, but this way,
I dont get the model changed.
So I need to give a CollectionModel instead ? How do I setup my own
collectionModel? Can you give me any hints or links to that? Im pretty
new to Trinidad, Seam and even to Java :-)
Thanks,
Tobias
Re: [Trinidad] Table model update?
Posted by Renzo Tomaselli <re...@tecnotp.it>.
Hi Tobias, I know nothing about Seam, but I had a table refresh problem
in the past, when my user was allowed to change colum layout/composition
on the fly.
In order to refresh the table children, I had to call:
((UIXTable)table).resetStampState();
where - of course - I got the actual component through the binding
attribute.
Model contents - e.g. rows - can change happily from request to request,
provided that you feed the table value attribute through a properly
up-to-date own CollectionModel. Btw, I assume using request-scoped beans
here.
-- Renzo
Tobias Kilian wrote:
> Any ideas to this? Pleeease...
>
>> Hi NG!
>>
>> Im using a trinidad tr:table inside my seam-application.
>>
>> The Problem:
>>
>> It seams, that the table model is only generated once, at the first
>> attempt to render the table and doesnt change afterwards. Is this
>> correct? I suppose it could be desired behavior, but that leads me into
>> trouble..
>>
>> The Situation:
>>
>> I have a selectionList on the left side and a tr:table at the right. I
>> want the tables underlying list to be one of left side's members. So the
>> selectItems value is #{tableInstance.selectedMaster}, while the tables
>> value attribute is #{tableInstance.selectedMaster.getSlaves()}" the
>> selectManyList has partialSubmit=true and is a trigger for the table, so
>> that works. I can select a master on the left and see all its slaves in
>> the table. However the tables model is not changing. Thats why the
>> table's getSelectedRowKeys() gives me wrong indices.
>>
>> Question:
>> is their a way to tell the tr:table to refresh its underlying model? How
>> else could i accomplish this?
>>
>> Many thanks,
>> Tobias Kilian
>>
>
>
>
Re: [Trinidad] Table model update?
Posted by Tobias Kilian <To...@gmx.de>.
Any ideas to this? Pleeease...
> Hi NG!
>
> Im using a trinidad tr:table inside my seam-application.
>
> The Problem:
>
> It seams, that the table model is only generated once, at the first
> attempt to render the table and doesnt change afterwards. Is this
> correct? I suppose it could be desired behavior, but that leads me into
> trouble..
>
> The Situation:
>
> I have a selectionList on the left side and a tr:table at the right. I
> want the tables underlying list to be one of left side's members. So the
> selectItems value is #{tableInstance.selectedMaster}, while the tables
> value attribute is #{tableInstance.selectedMaster.getSlaves()}" the
> selectManyList has partialSubmit=true and is a trigger for the table, so
> that works. I can select a master on the left and see all its slaves in
> the table. However the tables model is not changing. Thats why the
> table's getSelectedRowKeys() gives me wrong indices.
>
> Question:
> is their a way to tell the tr:table to refresh its underlying model? How
> else could i accomplish this?
>
> Many thanks,
> Tobias Kilian
>