您的选项 1是不可能的(为什么?因为要向页脚添加按钮controllerHook
没有 UI 扩展点)
使用选项 2已经在应用程序的详细信息页面的所有控制器( S3.controller.js和S3_phone.controller.js)中给出了 extensionHooks 。
控制器钩子:extHookChangeFooterButtons
默认情况下,SAP 构建 headerFooterOptions 并将该对象发送到您的扩展 Hook
/**
* @ControllerHook Modify the footer buttons
* This hook method can be used to add and change buttons for the detail view footer
* It is called when the decision options for the detail item are fetched successfully
* @callback hcm.emp.payslip.view.S3_Phone~extHookChangeFooterButtons
* @param {object} objHdrFtr-Header Footer Object
* @return {object} objHdrFtr-Header Footer Object
*/
if (this.extHookChangeFooterButtons) {
objHdrFtr = this.extHookChangeFooterButtons(objHdrFtr);
}
因此,您在扩展控制器中会收到相同的附加信息:
extHookChangeFooterButtons: function (objHdrFtr) {
//first if the buttonsList is empty, create one.
//Actually in S3.controller.js buttonsList is not defined since there are no buttons
if (!objHdrFtr.buttonList) {
objHdrFtr.buttonList = [];
}
//then create a button:
var extendedButton = {
sId: "EXT_BUTTON",
sI18nBtnTxt: "SAMPLE", //make sure you add texts in respective i18n files
bEnabled: true,
onBtnPressed: function (evt) {
that.handleExtButtonPress(evt);
}
};
objHdrFtr.buttonList.append(extendedButton)
//as you can see SAP says to return the object
return objHdrFtr;
}
建议:在Web IDE中很容易做到。
为什么?
- SETUP 无需时间。
- 非常容易使用,节省大量时间
- 在 UI 中显示所有 controllerHooks、扩展点