[ https://issues.apache.org/jira/browse/TOBAGO-963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bernd Bohmann resolved TOBAGO-963. ---------------------------------- Resolution: Fixed > It would be nice to have an @autoId in onclick attribute of tc:command > ---------------------------------------------------------------------- > > Key: TOBAGO-963 > URL: https://issues.apache.org/jira/browse/TOBAGO-963 > Project: MyFaces Tobago > Issue Type: Improvement > Components: Core > Affects Versions: 1.0.32 > Environment: All > Reporter: Helmut Swaczinna > Assignee: Bernd Bohmann > Priority: Minor > Fix For: 1.5.0-alpha-2, 1.0.33 > > > I solved the problem. Apply this to LayoutableRendererBase.java: > private void writeScriptForClientId(String clientId, Map.Entry<String, > UIComponent> facetEntry, > FacesContext facesContext, TobagoResponseWriter writer) throws > IOException { > if (facetEntry.getValue() instanceof UICommand > && ((UICommand) facetEntry.getValue()).getRenderedPartially().length > > 0) { > String script = > "var element = Tobago.element(\"" + clientId + "\");\n" > + "if (element) {\n" > + " Tobago.addEventListener(element, \"" + facetEntry.getKey() > + "\", function(){Tobago.reloadComponent2(this, '" > + HtmlRendererUtil.getComponentId(facesContext, > facetEntry.getValue(), > ((UICommand) facetEntry.getValue()).getRenderedPartially()[0]) > + "','" > + facetEntry.getValue().getClientId(facesContext) + "', > {})});\n" > + "}"; > writer.writeJavascript(script); > } else { > UIComponent facetComponent = facetEntry.getValue(); > String facetAction = (String) > facetComponent.getAttributes().get(ATTR_ONCLICK); > if (facetAction == null) { > facetAction = "Tobago.submitAction2(this, '" + > facetComponent.getClientId(facesContext) + "', " > + ComponentUtil.getBooleanAttribute(facetComponent, > ATTR_TRANSITION) + ", null, '" + clientId +"')"; > } else { > // Replace @autoId > facetAction = StringUtils.replace(facetAction, "@autoId", > facetComponent.getClientId(facesContext)); > } > String script = > "var element = Tobago.element(\"" + clientId + "\");\n" > + "if (element) {\n" > + " Tobago.addEventListener(element, \"" + > facetEntry.getKey() + "\", function(){" > + facetAction + "});\n}"; > writer.writeJavascript(script); > } > } > } -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira