Having now had the chance to tidy up my example code, here's my MixIn code
for the Grid Component:

@MixinAfter
public class ActionRows {
        
     public static final String event = "rowAction";

    @Parameter(value="click", defaultPrefix="literal")
     private String action;
        
    @Parameter(required=true)
     private String rowid;
        
    @Inject
     private ComponentResources resources;
        
    @AfterRender
    void after(MarkupWriter writer) {
        final String tbodyPath = "div/table/tbody";
        Element tbody = writer.getElement().find(tbodyPath);
        if (tbody == null) {
                throw new RuntimeException(...);
        }
        for (Node rowNode : tbody.getChildren()) {
                if (rowNode instanceof Element) {
                        ((Element) rowNode).attribute("on" + action, 
"window.location.assign('" +
resources.createActionLink(event, false, new Object[] { rowid }) + "')");
                }
        }
    } // end of AfterRender method
        
} // end of MixIn class ActionRows

and here's a typical page-usage scenario:

@Component(parameters = { "action=dblclick", "rowid=row.id", "row=row", ...
})
@MixinClasses(ActionRows.class)
private Grid displayData;

@OnEvent(value = ActionRows.event, component = ...)
public Object displayRow(int id) {
  ...
}

Hope that helps,

  Carl.
-- 
View this message in context: 
http://www.nabble.com/-T5--Linkable-rows-with-Grid-component-tf4519155.html#a12916995
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to