You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by membersound <me...@web.de> on 2012/11/01 15:06:55 UTC

Must a property of grid row be always directly in backing class?

HI,

must a t:grid row="object" always be in the backing page java class?
Or can I also have something like this:

t:grid source="service.objects" row="service.object"

class Page{
  @Inject
  @Property
  private ObjectService service;
}

class ObjectService {
  private List objects;
  private Object object;
}

I'm trying this, but maybe I'm doing something wrong. At least I always get
an exception:
Render queue error in BeginRender[admin/Page:grid.rows.gridcell]: Object
cannot be cast to ObjectService




--
View this message in context: http://tapestry.1045711.n5.nabble.com/Must-a-property-of-grid-row-be-always-directly-in-backing-class-tp5717526.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Must a property of grid row be always directly in backing class?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 01 Nov 2012 12:06:55 -0200, membersound <me...@web.de> wrote:

> HI,

Hi!

Grid doesn't care what kind of object you pass to its source parameter, as  
long as it is a GridDataSource or something that can be coerced to it  
(like Collections).

> t:grid source="service.objects" row="service.object"

Notice you're passing the objects property to source, not the service.

Using a service property as a row variable for Grid is something very  
dangerous, as usually services are singletons. Avoid doing that.

>
> class Page{
>   @Inject
>   @Property
>   private ObjectService service;
> }
>
> class ObjectService {
>   private List objects;
>   private Object object;
> }
>
> I'm trying this, but maybe I'm doing something wrong. At least I always  
> get
> an exception:
> Render queue error in BeginRender[admin/Page:grid.rows.gridcell]: Object
> cannot be cast to ObjectService

This is probably not your real code, so we cannot say what's wrong with  
that, and the error message doesn't match the presented code and template  
at all.

-- 
Thiago H. de Paula Figueiredo

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