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.33
Environment: All
Reporter: Helmut Swaczinna
Priority: Minor
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.
-
You can reply to this email to add a comment to the issue online.