Hi,

New Tapestry user here, started with a bootstrapped 5.7.3 and experimenting.

I tried to follow the grid example
https://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html
quite literally, however I had issues with coercion, so I simplified to try
to root out the issue.

What I now have is the simplest of table with a column for Delete links.
So the source is a List<Blah> while the row is of course a Blah.
onActionFromDelete only takes a Blah as argument.  And regardless, I get
org.apache.tapestry5.ioc.internal.OperationException

Exception in method
net.xytra.cirrus.pages.blog.admin.Languages.onActionFromDelete(net.xytra.cirrus.pages.blog.admin.Languages$Blah),
parameter #1: org.apache.tapestry5.commons.util.UnknownValueException:
Could not find a coercion from type java.lang.String to type
net.xytra.cirrus.pages.blog.admin.Languages$Blah.

Here's the grid in tml:
<html t:type="blogAdminLayout" title="List languages"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd";
      xmlns:p="tapestry:parameter">

Available Languages<br/>
<t:grid source="languages" row="test" add="delete">
 <p:deleteCell>
  <t:actionlink t:id="delete" context="test">Delete</t:actionlink>
 </p:deleteCell>
</t:grid>
Add language

</html>

And here's the class:
public class Languages {
    @Property
    private Blah test;

    public List<Blah> getLanguages() {
        List<Blah> list = new ArrayList<Blah>();
        list.add(new Blah(1));
        list.add(new Blah(2));
        return list;
    }

    public void onActionFromDelete(Blah test) {
        System.err.println("--- onActionFromDelete:
test.class="+test.getClass().getName()+" and test="+test);
    }

    public static class Blah {
        private int foo;

        public Blah(int bar) {
            foo = bar;
        }

        public String toString() {
            return Integer.toString(foo);
        }
    }
}

What am I doing wrong?  There is really no room for error, the Blah class
is defined right there in the same class and the current row object has
absolutely no reason to be converted to String.

Kindly help,

Jonathan

Reply via email to