Siebel IP14 – Enance Checkbox Behavior using Control Plugin-wrapper

A couple of previous posts have already demonstrated the good use of the IP14 Control Plugin-wrapper framework. Today again another simple use-case to demonstrate its potential.

In Open UI it turns out that selecting (or better changing) the value of a check box can be cumbersome. Especially if you want to quickly modify its value in a list applet. Form applets are just fine. Most important of all you need to quite correctly point your cursor on a relatively small area. Further the element containing the check box needs to have focus too, before you can change it.

Experimenting a bit I created a new control plugin-wrapper.

 .

Of course starting-off some solid boiler plate code…!

Implementing the AttachPW event

The usual set-up of a PW requires the implementation of the AttachPW event. This event basically defines for what type of control such as a Dropdown, MVG or Link it should act upon. From the Bookshelf you can get the available controls including the constant value Siebel works with internally. For a Check box this appears to be “SWE_CTRL_CHECKBOX”.

The AttachPW conceptually acts like a bouncer in a bar. It decides if the control’s behavior will be overridden or not. The bouncer will return true, what will make the PW control events to execute. By returning false, well nothing will happen.

PWCheckboxFrom a development perspective, creating plugin-wrappers should be considered carefully, since they could have a widespread impact. A simple typo or a statement which throws an (unhandled) error could make your whole Siebel application could be negatively affected. Further, since the effect of a plugin-wrapper is more or less global, we should refrain from too heavy or process-expensive code.

The AttachPW event allows us to prevent execution of override code, in case this is either not required or would potentially not work at all given the context a certain control type is rendered within.

In this example, I just bluntly return “true”, it passes.

Implementing the ShowUI event

Next, the actual code. All within the ShowUI event.

To get the control’s element is simply done by using the GetEl() method on the object. Following that we need to find the gridcell in the list applet to which the Check box is tied. By testing whether we actually received a value element we select upwards the DOM the closest gridcell.

If that results in a valid element, we can attach a double-click even to it. Whether you use JQuery style or otherwise to bind an event to an element is irrelevant. I opted for JQuery style.

Finally, to make things not more complicated than necessary, I simply simulate and end-user click, again in JQuery style. For that one can use the “trigger” method.

The Out-of-the-box Siebel code will process the event further and “Bob’s you uncle”!

PWCheckbox2

Enjoy and grab the full content here.

– Jeroen

Advertisements

6 thoughts on “Siebel IP14 – Enance Checkbox Behavior using Control Plugin-wrapper

  1. Hi Jeroen,
    I have associated this js File still its not loading does below line needs a argument SiebelAppFacade.CheckboxDblClickPW.superclass.constructor.apply(this, arguments);
    and SiebelAppFacade.CheckboxDblClickPW.superclass.ShowUI.apply(this, arguments);
    I am working on IP2015

    Regards
    Radheya Kahat

  2. Hi,

    I am trying this change in IP13 and mapped the file to specific list applet. But I am getting the below error and the file is not loaded. Please suggest
    Cannot read property ‘AttachPW’ of undefined

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s