You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by cqasker <cq...@yahoo.com> on 2011/10/03 22:17:50 UTC

Grid, is there any way dynamically defined columns?

Well I guess another week, another conundrum. I hope maybe you guys have some
suggestions

So say I have a Bean like:
public class Bean
{
   private String name;
   private Map&lt;String, Integer&gt; map;

   public String getName() { return name;}
   public Integer getMap(String columnHeader) {return
map.get(columnHeader);}
}

So basically I need a table where the column headers are the keys of map,
and the column cells have the map's values.

How can I tell the BeanModel to grab "getMap('columndHeader')" instead of
just a simple property? I don't mind implementing a new BeanModel
implementation to accomodate this requirement. Unfortunately I don't know
the columnHeaders or even all the possibilities as they are constantly
changed, added, removed from a datasource so I can't create a method like
public Integer getColumnA()
{return map.get("A");}

Is it possible to modify the grid to take an expression on the bean and then
execute the expression on the bean to get the grid cell value.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-is-there-any-way-dynamically-defined-columns-tp4866376p4866376.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: Grid, is there any way dynamically defined columns?

Posted by Norman Franke <no...@myasd.com>.
You should implement your own BeanModel and it can do whatever it wants.

As far as I know, you don't need to implement all of the methods,  
assuming you aren't using the model for editing. I implemented  
getBeanType (to return Object[].class), newInstance, getPropertyName,  
get and getById. My grids seem happy with this model.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Oct 3, 2011, at 4:17 PM, cqasker wrote:

> Well I guess another week, another conundrum. I hope maybe you guys  
> have some
> suggestions
>
> So say I have a Bean like:
> public class Bean
> {
>   private String name;
>   private Map&lt;String, Integer&gt; map;
>
>   public String getName() { return name;}
>   public Integer getMap(String columnHeader) {return
> map.get(columnHeader);}
> }
>
> So basically I need a table where the column headers are the keys of  
> map,
> and the column cells have the map's values.
>
> How can I tell the BeanModel to grab "getMap('columndHeader')"  
> instead of
> just a simple property? I don't mind implementing a new BeanModel
> implementation to accomodate this requirement. Unfortunately I don't  
> know
> the columnHeaders or even all the possibilities as they are constantly
> changed, added, removed from a datasource so I can't create a method  
> like
> public Integer getColumnA()
> {return map.get("A");}
>
> Is it possible to modify the grid to take an expression on the bean  
> and then
> execute the expression on the bean to get the grid cell value.
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-is-there-any-way-dynamically-defined-columns-tp4866376p4866376.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: Grid, is there any way dynamically defined columns?

Posted by resign <se...@yahoo.de>.
Hi,

a lot of time gone froml this post was sent.
Have found any solution for your problem?

Would you tell it? 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-is-there-any-way-dynamically-defined-columns-tp4866376p5716374.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: Grid, is there any way dynamically defined columns?

Posted by cqasker <cq...@yahoo.com>.
As usual -- the tap user forums comes through again. Step1 I need to
make/initialize my own BeanModel as Norman suggested -- step 2 is I need to
do my own PropertyConduit that will access my map. Makes complete sense,
thanks. I'll give it a go.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-is-there-any-way-dynamically-defined-columns-tp4866376p4870409.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