I don't follow how it would work because the constructor for CompositeCell takes in a list of HasCell objects and if the value provider for a column comes from a PropertyAccess interface implementation there's no way to get a list of HasCell objects.

Unless....you had your bean define a setter that returns a list of HasCell objects which then tightly couples your POJOs to a UI framework and violates the separation of concerns.

A POJO needs to be completely and totally independent of any framework and should not be doing any business logic or providing the data in anything other than a standard way. It should not be massaging data for use in a UI.

24 Feb 2012, 12:12 PM

sven

CompositeCell might not work for your custom usecase. However CompositeCell works very well with Grid and GXT.

If you require to render N objects and have them all clickable, why cannot you create a custom cell that just fits your needs?

24 Feb 2012, 1:06 PM

icfantv

Fair enough.

I have a custom cell that renders the items. I have not been able to make them clickable using the API. Making them clickable in HTML, in the render method, would be easy but I don't want to have custom JavaScript calls - there's a term for this, but I can't remember it. I think it's four letters.

24 Feb 2012, 1:34 PM

sven

I again cannot follow you. Why cannot you listen to the click event and check for the target in your custom cell? All cells work like this.

24 Feb 2012, 3:08 PM

icfantv

I'm sorry I am not being clear.

Data for each row in my grid comes from GXTs PropertyAccess<T> interface. In my case, T is a bean that has a method that returns a list of M, i.e., another bean type. This list varies in length.

For the composite cell in question, I cannot simply render the list of M. I essentially need to construct a list of ClickableTextCell objects and render this list.

When I call setCell(new CompositeCell(...)), I need to pass in a list of HasCell objects and I don't know how to construct them because I don't have an instance of T, all I have is T itself. So, I can't get a list of M objects to be able to construct the list of HasCell objects and I can't think of a way to get them.

24 Feb 2012, 3:29 PM

sven

In that case you need to have a Cell that acepts a list of T as value and can render it. You will need to have a custom cell for this.

For the composite cell in question, I cannot simply render the list of M. I essentially need to construct a list of ClickableTextCell objects and render this list.

A template would exactly do this.

A Tempalte just renders markup. You still need to have an own cell that makes different actions depening on where you clicked. The composite cell containing multiple clickable cells would not do anything else.

30 Apr 2012, 7:30 AM

sven

Another note for others interested in this. If Xtemplate works for this, than you can also use any other cell that can render simpel markup and iterate over the list directly.

The problem with xtemplate/markup is that you need to make your logic for the click related to the target element on your own.

30 Apr 2012, 7:34 AM

icfantv

Ahhhhh. Right. I left that bit out. In my custom cell, I check the event type in onBrowserEvent(...) and handle it appropriately based on what was clicked.

Since our use case doesn't require handlers, i.e., multiple listeners, I simply construct the cell with callback handlers for the pieces I want to listen to. It's not "technically" a composite cell as it's still just one table cell, but it IS far easier to work with since you don't have to have to have your HasCells up front like you do with CompositeCell.