You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thomas Beckmann <th...@freiheit.com> on 2007/07/12 14:50:26 UTC

T5: Grid component - available properties

Hi,

I followed the discussion about Grid component and Date.
I had the same problem and tryed to solve it by using t:parameter and t:output 
but it didn't work since my date column was not available.
Only columns with supported types are available.

Wouldn't it be better to just not render those types that are not supported or 
even throw an exception so the user has to exclude them explicitly?
Because even if date will be supported in the future, the problem remains for 
other types.
I can not provide a custom component as described in screencast 5 if the type 
of the row is not supported.

Thanks
Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Grid component - available properties

Posted by Daniel Jue <te...@gmail.com>.
Joost, thanks for the code snippet --I think it got me on the right track.

Can I define this snippet in Java code somehow?

<t:parameter t:name="yourUnknowBeanPropertyCell">
    ${myRow.yourUnknowBeanProperty.somethingPresentable}
<t: parameter>

I want tapestry to automatically know how to display the property.
How can I provide that knowledge?

I hope this will allow Grid to sort by comparing
yourUnknowBeanProperty, NOT
yourUnknowBeanProperty.somethingPresentable.  (i.e. You may want Dates
to sort from oldest to newest, but you want the Year printed at the
end of the Date string.)







On 7/18/07, Joost Schouten <jo...@jsportal.com> wrote:
> Thomas,
>
> You can explicitly add your column to the BeanModel like:
>
> @Inject
> private BeanModelSource bms;
>
> @Inject
> private ComponentResources resources;
>
> private BeanModel model;
>
> private YourRowObject myRow;
>
> @SetupRender
> void initialize(){
>         model = bms.create(YourRowObject.class, false, resources);
>         model.add("yourUnknowBeanProperty")
>                                 .order(columnOrder)
>                                 .label("My great new column");
> }
>
> ... getters and setters ...
>
> In your html:
>
> <table t:type="grid" t:source="yourSource" t:model="model" t:row="myRow">
>         <t:parameter t:name="yourUnknowBeanPropertyCell">
>                 ${myRow.yourUnknowBeanProperty.somethingPresentable}
>         <t: parameter>
> </table>
>
> I build a component around myRow.yourUnknowBeanProperty to properly display
> it. In the same way I print dates in my table.
>
> Regards,
> Joost
>
> -----Original Message-----
> From: Thomas Beckmann [mailto:thomas.beckmann@freiheit.com]
> Sent: Friday, July 13, 2007 12:50 AM
> To: Tapestry users
> Subject: T5: Grid component - available properties
>
> Hi,
>
> I followed the discussion about Grid component and Date.
> I had the same problem and tryed to solve it by using t:parameter and
> t:output
> but it didn't work since my date column was not available.
> Only columns with supported types are available.
>
> Wouldn't it be better to just not render those types that are not supported
> or
> even throw an exception so the user has to exclude them explicitly?
> Because even if date will be supported in the future, the problem remains
> for
> other types.
> I can not provide a custom component as described in screencast 5 if the
> type
> of the row is not supported.
>
> Thanks
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: Grid component - available properties

Posted by Joost Schouten <jo...@jsportal.com>.
Thomas,

You can explicitly add your column to the BeanModel like:

@Inject
private BeanModelSource bms;

@Inject
private ComponentResources resources;

private BeanModel model;

private YourRowObject myRow;

@SetupRender
void initialize(){
	model = bms.create(YourRowObject.class, false, resources);
	model.add("yourUnknowBeanProperty")
				.order(columnOrder)
				.label("My great new column");
}

... getters and setters ...

In your html:

<table t:type="grid" t:source="yourSource" t:model="model" t:row="myRow">
	<t:parameter t:name="yourUnknowBeanPropertyCell">
		${myRow.yourUnknowBeanProperty.somethingPresentable}
	<t: parameter>
</table>

I build a component around myRow.yourUnknowBeanProperty to properly display
it. In the same way I print dates in my table.

Regards,
Joost 

-----Original Message-----
From: Thomas Beckmann [mailto:thomas.beckmann@freiheit.com] 
Sent: Friday, July 13, 2007 12:50 AM
To: Tapestry users
Subject: T5: Grid component - available properties

Hi,

I followed the discussion about Grid component and Date.
I had the same problem and tryed to solve it by using t:parameter and
t:output 
but it didn't work since my date column was not available.
Only columns with supported types are available.

Wouldn't it be better to just not render those types that are not supported
or 
even throw an exception so the user has to exclude them explicitly?
Because even if date will be supported in the future, the problem remains
for 
other types.
I can not provide a custom component as described in screencast 5 if the
type 
of the row is not supported.

Thanks
Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org