Author: nbelaevski
Date: 2008-08-03 17:50:24 -0400 (Sun, 03 Aug 2008)
New Revision: 9871
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-4061
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
===================================================================
---
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-08-03
21:29:54 UTC (rev 9870)
+++
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-08-03
21:50:24 UTC (rev 9871)
@@ -35,8 +35,8 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.component.JavaScriptParameter;
+import org.ajax4jsf.javascript.JSBind;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
@@ -254,17 +254,19 @@
if (isImmediate) {
attachContextMenuBuffer.append(attachContextMenuFunction.toScript());
- } else if (isOnAvailable) {
- JSFunction availableFunction = new JSFunction("Richfaces.onAvailable");
- availableFunction.addParameter(clientId);
- availableFunction.addParameter(new
JSFunctionDefinition().addToBody(attachContextMenuFunction));
+ } else {
+ if (isOnAvailable) {
+ JSFunction availableFunction = new JSFunction("Richfaces.onAvailable");
+ availableFunction.addParameter(clientId);
+ availableFunction.addParameter(new JSBind(attachContextMenuFunction,
"contextMenu"));
+ attachContextMenuBuffer.append(availableFunction.toScript());
+
+ } else if (isOnLoad) {
+ JSFunction onloadFunction = new JSFunction("jQuery(document).ready");
+ onloadFunction.addParameter(new JSBind(attachContextMenuFunction,
"contextMenu"));
- attachContextMenuBuffer.append(availableFunction.toScript());
- } else if (isOnLoad) {
- JSFunction onloadFunction = new JSFunction("jQuery(document).ready");
- onloadFunction.addParameter(new
JSFunctionDefinition().addToBody(attachContextMenuFunction));
-
- attachContextMenuBuffer.append(onloadFunction.toScript());
+ attachContextMenuBuffer.append(onloadFunction.toScript());
+ }
}
attachContextMenuBuffer.append(";");