sap.m.TableSelectDialog:自定义页脚中的按钮文本
sap.m.TableSelectDialog: Customize Button Texts in the Footer
我想以某种方式获取 TableSelectDialog
的 Confirm 和 Cancel 按钮来更改文本。但我不知道如何正确地做到这一点。
在我看来,最好的解决方案是在片段中设置按钮,但没有像 sap.m.Dialog
中那样的 <buttons>
聚合。那么如何在页脚工具栏中使用我自己的文本设置我的按钮?
<TableSelectDialog xmlns="sap.m"
noDataText="No Products Found"
title="Select Product"
search=".handleSearch"
confirm=".handleClose" -> want this button
cancel=".handleClose" -> want this button
multiSelect="true"
....
</TableSelectDialog>
如果我没理解错的话,您正在尝试更改“确定”和“取消”按钮的文本。
为了做到这一点,尽管我希望其他人提供更好的解决方案,但您可以尝试以下方法:
1) 将 id
分配给您的 TableSelectDialog
:
<TableSelectDialog
noDataText="No Products Found"
title="Select Product"
search="handleSearch"
confirm="handleClose"
cancel="handleClose"
multiSelect="true"
id="IdTableSelectionDialog">
...
</TableSelectDialog>
2) 在打开对话框之前尝试以下操作:
//Change the OK button text
sap.ui.getCore().byId("IdTableSelectionDialog")._getOkButton().setText("New value you want to use");
//Change the Cancel button text
sap.ui.getCore().byId("IdTableSelectionDialog")._getCancelButton().setText("New value you want to use");
As of UI5 version 1.68.x, sap.m.TableSelectDialog
以及 sap.m.SelectDialog
提供了一个新的 属性 称为 confirmButtonText
1.
<TableSelectDialog xmlns="sap.m"
confirmButtonText="{i18n>myOwnConfirmText}"
....
</TableSelectDialog>
不过目前还没有publicAPI可以自定义取消按钮。您将不得不依赖以前的解决方案(访问我们都强烈反对的私有 API)或者只保留标准文本,这不仅提高了向上兼容性,而且 UI 与其他 Fiori 的一致性应用程序。
我想以某种方式获取 TableSelectDialog
的 Confirm 和 Cancel 按钮来更改文本。但我不知道如何正确地做到这一点。
在我看来,最好的解决方案是在片段中设置按钮,但没有像 sap.m.Dialog
中那样的 <buttons>
聚合。那么如何在页脚工具栏中使用我自己的文本设置我的按钮?
<TableSelectDialog xmlns="sap.m"
noDataText="No Products Found"
title="Select Product"
search=".handleSearch"
confirm=".handleClose" -> want this button
cancel=".handleClose" -> want this button
multiSelect="true"
....
</TableSelectDialog>
如果我没理解错的话,您正在尝试更改“确定”和“取消”按钮的文本。
为了做到这一点,尽管我希望其他人提供更好的解决方案,但您可以尝试以下方法:
1) 将 id
分配给您的 TableSelectDialog
:
<TableSelectDialog
noDataText="No Products Found"
title="Select Product"
search="handleSearch"
confirm="handleClose"
cancel="handleClose"
multiSelect="true"
id="IdTableSelectionDialog">
...
</TableSelectDialog>
2) 在打开对话框之前尝试以下操作:
//Change the OK button text
sap.ui.getCore().byId("IdTableSelectionDialog")._getOkButton().setText("New value you want to use");
//Change the Cancel button text
sap.ui.getCore().byId("IdTableSelectionDialog")._getCancelButton().setText("New value you want to use");
As of UI5 version 1.68.x, sap.m.TableSelectDialog
以及 sap.m.SelectDialog
提供了一个新的 属性 称为 confirmButtonText
1.
<TableSelectDialog xmlns="sap.m"
confirmButtonText="{i18n>myOwnConfirmText}"
....
</TableSelectDialog>
不过目前还没有publicAPI可以自定义取消按钮。您将不得不依赖以前的解决方案(访问我们都强烈反对的私有 API)或者只保留标准文本,这不仅提高了向上兼容性,而且 UI 与其他 Fiori 的一致性应用程序。