Modifications Required for DOM Elements Configured in SWE OUI Templates
You must find and modify the instances of DOM elements configured in SWE OUI templates in your custom physical renderer code. The ID or the name used to find the DOM will have been configured as a placeholder using a SWE OUI Template file.
To bind DOM elements configured in SWE OUI templates
Determine if you have custom physical renderer code similar to the following:
CustomPhysicalRenderer.prototype.BindEvents = function(){ $("[id=" + "customdiv" + "]").bind("click", { ctx : this }, function(event){ event.data.ctx.GetPM().OnControlEvent(("DIV_CLOSE")); }); SiebelAppFacade.CustomPhysicalRenderer.superclass.BindEvents.call(this); };
This event will be attached to a handler in a custom presentation model using an
AttachEventHandler
call. The call will then trigger custom functionality when the handler is run. A possible outcome of this handler is to affect a model property, which would subsequently be latched on to by a PM binding in the renderer that would hide or remove the div element.-
Modify the code located in Step 1 to resemble the following code:
CustomPhysicalRenderer.prototype.BindEvents = function () { var closeElement = $("[id=" + "customdiv " + "]"), eventHelper = SiebelApp.S_App.PluginBuilder.GetHoByName("EventHelper"); if (eventHelper && closeElement.length) { eventHelper.Manage(closeElement, "click", { ctx: this }, OnClickDiv); } SiebelAppFacade.CustomPhysicalRenderer.superclass.BindEvents.call(this); }; function OnClickDiv(event) { event.data.ctx.GetPM().OnControlEvent(consts.get("DIV_CLOSE")); }
Note: The code in this example is only meant as a guide.This click event in this code is attached to the stray DOM element using the Manage API of the Event Helper object. The click is homogenized to work with touch based events on touch based devices. OnClickDiv is the handler that is passed.
For the full list of parameters that the Manage API uses, see Application Programming Interface.