public WidgetBuilder initWithComponentLoad(String widgetClass, String widgetVar, String id, String targetId) throws IOException { this.renderScriptBlock(id); context.getResponseWriter().write("PrimeFaces.onElementLoad($(PrimeFaces.escapeClientId(\"" + targetId + "\")),function(){"); this.init(widgetClass, widgetVar, id, true); return this; }
public WidgetBuilder initWithWindowLoad(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); context.getResponseWriter().write("$(window).on(\"load\",function(){"); this.init(widgetClass, widgetVar, id, true); return this; }
public WidgetBuilder init(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); // AJAX case: since jQuery 3 document ready ($(function() {})) are executed async // this would mean that our oncomplete handlers are probably called before the scripts in the update nodes // or // we can also skip it when MOVE_SCRIPTS_TO_BOTTOM is enabled as the scripts are already executed when everything is ready if ((context.isPostback() && context.getPartialViewContext().isAjaxRequest()) || configuration.isMoveScriptsToBottom()) { this.init(widgetClass, widgetVar, id, false); } else { context.getResponseWriter().write("$(function(){"); this.init(widgetClass, widgetVar, id, true); } return this; }
public WidgetBuilder init(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); this.init(widgetClass, widgetVar, id, false); return this; }
public WidgetBuilder initWithWindowLoad(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); context.getResponseWriter().write("$(window).on(\"load\",function(){"); this.init(widgetClass, widgetVar, id, true); return this; }
public WidgetBuilder initWithComponentLoad(String widgetClass, String widgetVar, String id, String targetId) throws IOException { this.renderScriptBlock(id); context.getResponseWriter().write("$(PrimeFaces.escapeClientId(\"" + targetId + "\")).on(\"load\",function(){"); this.init(widgetClass, widgetVar, id, true); return this; }
public WidgetBuilder initWithDomReady(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); // since jQuery 3 document ready ($(function() {})) are executed async // this would mean that our oncomplete handlers are probably called before the scripts in the update nodes // or // we can also skip it when MOVE_SCRIPTS_TO_BOTTOM is enabled as the scripts are already executed when everything is ready if (context.isPostback() || configuration.isMoveScriptsToBottom()) { this.init(widgetClass, widgetVar, id, false); } else { context.getResponseWriter().write("$(function(){"); this.init(widgetClass, widgetVar, id, true); } return this; }