Add the user preference to your custom physical renderer and presentation model:
- Use a JavaScript editor to open your custom physical renderer that renders the Opportunity List Applet.
- Add the custom user preference. You add the following code:
var pm = this.GetPM();
var inputPS = CCFMiscUtil_CreatePropSet();
inputPS.SetProperty("Key", "user_preference_name");
inputPS.SetProperty("user_preference_name", "user_preference_value");
pm.OnControlEvent(siebConsts.get("PHYEVENT_INVOKE_CONTROL"), pm.Get(siebConsts.get("SWE_MTHD_UPDATE_USER_PREF")), inputPS);
pm.SetProperty("user_preference_name", "user_preference_value");
- Use a JavaScript editor to open your custom presentation model that renders the Opportunity List Applet.
- Add a presentation model property that references the custom user preference. You add the following code
var pm = this.GetPM();
var value = pm.Get("user_preference_name");
You must make sure that Siebel Open UI derives your custom presentation model from the Presentation Model class. This class contains the logic that saves user preferences in presentation model properties. For more information, see Adding Presentation Model Properties That Siebel Servers Send to Clients.
Add the expand and collapse button:
- Use a JavaScript editor to open the physical renderer that you edited in Step 1, Step a.
- Add the following code to the end of the Show method:
var id1 = this.GetPM().Get("GetFullId") + '-siebui-cust-expandcollapse-btn';
var expcolbtn = "<button " +
"id= '" + id1 + "' " +
"class= 'appletButton' " +
"aria-label=ExpandCollapse " +
"type=\"button\" " +
"title=ExpandCollapse " + ">" + "ExpandCollapse" + "</button>";
- Add the following code to the end of the BindEvent method. This code binds the button click.
$("#" + pm.Get("GetFullId") + "-" + "siebui-cust-expandcollapse-btn").bind("click", {ctx: this},
function (e) {
var self = e.data.ctx,
pm = self.GetPM();
SiebelJS.Log("Expand");
var inputPS = CCFMiscUtil_CreatePropSet();
var value = pm.Get ("Expand-Collapse");
inputPS.SetProperty("Key", "Expand-Collapse");
if(value === "Collapse")
{
inputPS.SetProperty("Expand-Collapse", "Expand");
pm.SetProperty("Expand-Collapse", "Expand");
}
else
{
inputPS.SetProperty("Expand-Collapse", "Collapse");
pm.SetProperty("Expand-Collapse", "Collapse");
}
pm.OnControlEvent(siebConsts.get("PHYEVENT_INVOKE_CONTROL"),pm.Get(siebConsts.get("SWE_MTHD_UPDATE_USER_PREF")), inputPS);
if(value === "Collapse")
{
pm.SetProperty("Expand-Collapse", "Expand");
//Write Code to expand the applet
$("#s_" + pm.Get("GetFullId") + "_div").find(".siebui-collapsible-applet-content").show();
}
else
{
pm.SetProperty("Expand-Collapse", "Collapse");
//Write Code to collapse the applet
$("#s_" + pm.Get("GetFullId") + "_div").find(".siebui-collapsible-applet-content").hide();
}
}
);
- Add the following code to the end of the ShowUI method. This code accesses the default value of the custom Expand-Collapse user preference, and then instructs Siebel Open UI to display the applet as expanded or collapsed according to the user preference value:
PhysicalRenderer.prototype.ShowUI()
{
var pm = this.GetPM();
var value = pm.Get ("Expand-Collapse");
if(value === "Collapse")
{
//Write Code to collapse the applet
$("#s_" + pm.Get("GetFullId") + "_div").find(".siebui-collapsible-applet-content").hide();
}
else
{
//Write Code to expand the applet
$("#s_" + pm.Get("GetFullId") + "_div").find(".siebui-collapsible-applet-content").show();
}
}
- Use an HTML editor to open the HTML that Siebel Open UI uses to display the Opportunity List Applet, and then add the following code:
$("#s_" + this.GetPM().Get("GetFullId") + "_div").find(".siebui-collapsible-applet").append(expcolbtn);
For more information about how to edit HTML code for an applet, see Customizing Logos, Themes, Backgrounds, Tabs, Styles, and Fonts.