Hi Guys, I'm trying to use the T5 components InPlaceEditor inside a grid component in this way
<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" > <table t:type="Grid" t:source="prop:source" t:row="row" rowsPerPage="4" > <t:parameter name="nameCell"> <div t:type="template/componenti/componentigenerici/SailingInPlaceEditor" t:value="prop:row.name" t:currentRowId="prop:row.id" > </div> </t:parameter> <t:parameter name="linkCell"> click me gently </t:parameter> </table> where the SailingInPlaceEditor is the same of the T5components InPlaceEditor but with some add on, to try to make everything ok. SailingInPlaceEditor.java public class SailingInPlaceEditor { @Inject @Path("${tapestry.scriptaculous}/prototype.js") private Asset _prototype; @Inject @Path("classpath:/it/sailingweb/framework/web/resources/js/InPlaceEditor.js") private Asset _script; @Inject @Path("classpath:/it/sailingweb/framework/web/resources/css/inplaceeditor.css") private Asset _styleCSS; @Inject private ComponentResources _resources; @Environmental private PageRenderSupport _pageRenderSupport; @Inject private Request _request; @Parameter(required = true) private String _value; @Parameter(required = false, defaultPrefix = "literal") private String _size = "20"; private String clientId; @Inject private Logger logger; @Parameter(required=true,name="currentRowId") private String currentRowId; @Persist private String currentId; private boolean rowUpdated; @BeginRender void doBeginRender(MarkupWriter writer) { currentId=currentRowId; _pageRenderSupport.addScriptLink(_script, _prototype); _pageRenderSupport.addStylesheetLink(_styleCSS, "screen"); clientId=_pageRenderSupport.allocateClientId(_resources.getId()); writer.element("span", "id", clientId); if (_value != null) writer.write(_value); } @AfterRender void doAfterRender(MarkupWriter writer) { writer.end(); _pageRenderSupport.addScript("EditInPlace.makeEditable({id:'%s', size:%s, select_text:true, " + "savebutton_text:'%s'," + "cancelbutton_text:'%s'," + "saving_text:'%s'," + "empty_text:'%s'," + "edit_title:'%s'," + "savefailed_text:'%s'," + "orig_text:'%s'," + "save_url:'%s'});", clientId, _size, _resources.getMessages().get("savebutton"), _resources.getMessages().get("cancelbutton"), _resources.getMessages().get("saving"), _resources.getMessages().get("empty"), _resources.getMessages().get("title"), _resources.getMessages().get("savefailed"), _value == null ? "" : _value, getActionLink()); } @OnEvent(value = "action") private StreamResponse onAction(String value) { rowUpdated=true; _value = value; return new JSONStreamResponse(value, true); } public String getValue() { return _value; } public void setValue(String value) { _value = value; } public String getActionLink() { return _resources.createActionLink(TapestryConstants.ACTION_EVENT, false).toURI(); } public boolean isRowUpdated() { return rowUpdated; } public void setRowUpdated(boolean rowUpdated) { this.rowUpdated = rowUpdated; } public String getCurrentRowId() { return currentRowId; } public void setCurrentRowId(String currentRowId) { this.currentRowId = currentRowId; } public String getCurrentId() { return currentId; } public void setCurrentId(String currentId) { this.currentId = currentId; } and the SailingGrid.java is that public class SailingGrid { @Parameter(name="source",required=true) private List source; @Parameter(name="rowsPerPage") private int rowsPerPage; @Inject private ComponentResources resources; @Inject private Logger logger; private EntityTest row; @Component(id="SailingInPlaceEditor") private SailingInPlaceEditor inPlaceEditor; @OnEvent(component="addRow") private void addTableRow(){ source.add(new EntityTest("9L","new_val",0,"sample")); } public List getSource() { return source; } public void setSource(List source) { this.source = source; } public int getRowsPerPage() { return rowsPerPage; } public void setRowsPerPage(int rowsPerPage) { this.rowsPerPage = rowsPerPage; } private EntityTest getEntityById(String id){ Iterator it=source.iterator(); while (it.hasNext()){ EntityTest et=(EntityTest)it.next(); if (et!=null && et.getId().equals(id)) return et; } return null; } public EntityTest getRow() { logger.info("### is row updated:"+inPlaceEditor.isRowUpdated()); if (inPlaceEditor.isRowUpdated()){ // in questo caso il binding richiesto da tapestry รจ con la riga aggiornata che // devo recuperare opportunamente dalla lista altrimenti // restituirebbe sempre l'ultima persistita in sessione (ossia l'ultima della lista) String id=inPlaceEditor.getCurrentId(); logger.info("### row id:"+id); return getEntityById(id); } return row; } public void setRow(EntityTest row) { this.row= row; } what I'm gonna try to do is to update my source data model of my List<EntityTest>.May be it's not the rigth way to procede, but I think it's the more elegant way to procede (I hope;). How coult I tell T5 binding how to procede? I just need to retrieve the right row id during the getRow (called by tapestry during the value binding) to let the getter method return the rigth row to be updated. I've supposed that during the grid looping over the component an InPlaceEditor is created for each loop, but it should not be exact because the component should be reused from the pool isn't it, so I can't use instance variable to store into each InPlace component the row Id (with a persist annotation) isn't it? Have you got any ideas? Thanks in advance. Cheers -Rick -- View this message in context: http://www.nabble.com/T5-component-inplaceeditor-in-a-datagrid-tp15122474p15122474.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]