It's a two step process.
1. Define a model in your Java class. It's easy to just use the standard
definition and extend it like so:
@Inject
private BeanModelSource _beanModelSource;
@Inject
private ComponentResources _resources;
@Retain
private BeanModel _model;
void pageLoaded() {
_model = _beanModelSource.create(VideoClip.class, true, _resources);
_model.remove("id");
_model.add("action", null);
}
public BeanModel getModel() {
return _model;
}
Note the _model.add("action", null); that sets a null conduit meaning the grid
will not try to pull values for that column from the underlying bean. In other
words, its a utility column where you can put whatever you like. Note the name
of the model is just model as its accessed via the getModel() method.
2. Add a model="name-of-your-model-in-your-Java-class" to your grid in your
.tml file. In this case it is model="model" e.g.:
<table t:type="grid" source="videos" row="video" model="model" rowsPerPage="5"
pagerPosition="both">
<t:parameter name="titleCell">
<t:pagelink page="demo/VideoDetails"
context="video.id">${video.title}</t:pagelink>
</t:parameter>
<t:parameter name="actionCell">
<t:pagelink page="demo/EditVideo" context="video.id">Edit</t:pagelink>
</t:parameter>
</table>
I've added a bunch of other stuff, but you should get the idea.
HTH
CarstenM <[EMAIL PROTECTED]> wrote:
Hi again,
no example for this or what's wrong?
Cheers
Carsten
CarstenM wrote:
>
> Hello,
>
> still trying to use the GridRows component.
> Can someone give an example for a GridModelProvider or the GridRows
> component?
> Well, the Grid is an implementation of GridModelProvider but I would like
> to
> customize my rows.
>
> Thanks,
> Carsten
>
>
> (Thread relates to T5.0.6 - How to use GridRows)
>
>
--
View this message in context:
http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]