Hi Christopher,
Here are three suggestions to achieve what you are trying to do.
(1) Omit the 'model' parameter to let Tapestry create a default model. Use the
'add' parameter to add a column named 'crewman' to that model. In the template
file, in the body of the grid component, define how to render that cell as
follows:
<p:crewmanCell>
${crewman.name}
</p:crewmanCell>
(2) Let Tapestry create the model and tailor it in the Page class.
@Property
BeanModel<Crewman> model;
@Inject
BeanModelSource modelSource;
@Inject
Messages messages;
void setupRender() {
model = modelSource.createDisplayModel(Crewman.class, messages);
model.addExpression("crewman", "crewman.name");
}
Also add <t:grid ... model="model" ... /> to the template.
(3) Tell Tapestry how to display Crewman as described in the 'Adding New
Property Editors' section on the
https://tapestry.apache.org/beaneditform-guide.html page. (I just realized
those docs need to be improved/extended to cover not only PropertyEditors but
also PropertyDisplays. You will need PropertyDisplays - hope you can figure it
out even though it's not in docs yet.)
Cheers,
Volker
On 2022/05/13 10:38:18 "Christopher Dodunski (Tapestry)" wrote:
> Hi all,
>
> I'm trying out the Tapestry Grid component for the first time in one of
> my projects. During rendering I'm presented with the below exception.
>
> "Render queue error in BeginRender[vessel/Read:grid.rows]: Failure
> writing parameter 'row' of component vessel/Read:grid.rows: Failure
> writing parameter 'row' of component vessel/Read:grid: Could not find a
> coercion from type [Ljava.lang.Object; to type
> com.optomus.harbour.entities.Crewman."
>
> Not a problem, I thought, just need to add an encoder to the page's Java
> class file. Same as I've done several times before with the Tapestry
> Palette component.
>
> <t:grid source="crewmen" row="crewman" model="crewModel"
> encoder="crewEncoder" rowsPerPage="30" pagerPosition="both">
>
> Unfortunately, with Grid, it's not had the same desired effect—whilst
> the model parameter successfully gets from "public BeanModel
> getCrewModel(){...}" the encoder parameter isn't getting from "public
> ValueEncoder<Crewman> getCrewEncoder(){...}".
>
> What am I missing?
>
> Thanks & regards,
>
> Chris.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]