あなたのオプション1は不可能です(なぜですか?フッターにボタンを追加するためのcontrollerHook
UI拡張ポイントがないためです)
オプション 2では、アプリケーションの詳細ページのすべてのコントローラー ( S3.controller.js および S3_phone.controller.js ) に既に extensionHooks が指定されています。
コントローラーフック:extHookChangeFooterButtons
デフォルトでは、SAP は headerFooterOptions を作成し、そのオブジェクトを拡張フックに送信します。
/**
* @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 で行うのは非常に簡単です。
なんで?
- セットアップに時間がかかりません。
- 非常に使いやすく、多くの時間を節約できます
- すべてのコントローラーフック、拡張ポイントを UI に表示します