Set value of choice list with condition
In the Add caseIn the Page Designer area, click the “Show or Hide Hidden Widgets” toolbar button.
In the Widgets palette, expand the “Utility Widgets” group.
Drag the “Script Adaptor” widget into the Hidden widget area.
In the “Javascript:” box, paste the following code:
console.log("Registering choice function");
var coord = payload.coordination;
var caseEditable = payload.caseEditable;
require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants"],function(ControllerManager, Constants){
coord.participate(Constants.CoordTopic.LOADWIDGET, function(context, complete, abort)
{
//var propsController = ControllerManager.bind(workItemEdt);
var propsController = ControllerManager.bind(caseEditable);
var trantypeController = propsController.getPropertyController(theProp);
console.log("ERROR - No such property: " + trantypeController);
if (trantypeController)
{
var oldtranstypeChoice = trantypeController.get("choices");
var elementPoscode;
var choices = oldtranstypeChoice.choices;
var newChoices = [];
for (var j = 0; j < choices.length; j++)
{
elementPoscode = choices[j];
if (elementPoscode.value == "100000")
{
console.log("ERROR - No such property: " + elementPoscode.value);
newChoices.push(elementPoscode);
break;
}
}
trantypeController.set("choices", newChoices);
}
else
console.log("ERROR - No such property: " + theProp);
complete();
});
/* Use the AFTERLOADWIDGET coordination topic handler to release the controller binding for the editable. */
/* Since the prop controller can be shared, doing this in the AFTERLOADWIDGET ensures no other widget overrides your changes. */
coord.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort) {
/* Release the controller binding for the editable. */
ControllerManager.unbind(caseEditable);
/* Call the coordination completion method. */
complete();
});
});
In the Work Detail
In the Page Designer area, click the “Show or Hide Hidden Widgets” toolbar button.
In the Widgets palette, expand the “Utility Widgets” group.
Drag the “Script Adaptor” widget into the Hidden widget area.
In the “Javascript:” box, paste the following code:
console.log("Registering choice function");
var coord = payload.coordination;
var caseEditable = payload.workItemEditable;
require(["icm/model/properties/controller/ControllerManager", "icm/base/Constants"],function(ControllerManager, Constants){
coord.participate(Constants.CoordTopic.LOADWIDGET, function(context, complete, abort)
{
//var propsController = ControllerManager.bind(workItemEdt);
var propsController = ControllerManager.bind(caseEditable);
var trantypeController = propsController.getPropertyController(theProp);
console.log("ERROR - No such property: " + trantypeController);
if (trantypeController)
{
var oldtranstypeChoice = trantypeController.get("choices");
var elementPoscode;
var choices = oldtranstypeChoice.choices;
var newChoices = [];
for (var j = 0; j < choices.length; j++)
{
elementPoscode = choices[j];
if (elementPoscode.value == "100000")
{
console.log("ERROR - No such property: " + elementPoscode.value);
newChoices.push(elementPoscode);
break;
}
}
trantypeController.set("choices", newChoices);
}
else
console.log("ERROR - No such property: " + theProp);
complete();
});
/* Use the AFTERLOADWIDGET coordination topic handler to release the controller binding for the editable. */
/* Since the prop controller can be shared, doing this in the AFTERLOADWIDGET ensures no other widget overrides your changes. */
coord.participate(Constants.CoordTopic.AFTERLOADWIDGET, function(context, complete, abort) {
/* Release the controller binding for the editable. */
ControllerManager.unbind(caseEditable);
/* Call the coordination completion method. */
complete();
});
});
Hi Chào bạn,
Trả lờiXóaCho mình hỏi trong ECM mình muốn xử lý xử kiện click choice list thì load giá trị ở 1 choise list khác giống như xử lý trên các ngôn ngữ khác C# hay Java... thông thường thì như thế nào bạn ?