更改WizardStep按钮文本

时间:2017-07-14 08:13:48

标签: sapui5 wizard

如何重命名每个WizardStep的按钮文本(默认“步骤1”到“步骤n”)?

对于整个Wizard,可以通过设置属性finishButtonText来设置完成按钮的文本。但是WizardStep没有类似的属性。

3 个答案:

答案 0 :(得分:1)

您是否查找过Wizard控件的探索参考? 可以通过“title”参数编辑每个向导步骤标题 https://sapui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.Wizard/preview

否则请从您的应用程序中提供代码示例

答案 1 :(得分:1)

没有健全,正确的方法来更改下一个按钮文本(我能找到)。

但是这里有两个可能有帮助的解决方法,而其他人给出了更好的答案:

“下一个按钮”是当前向导步骤内容的最后一个控件

myWizardStep.getContent()[lastIndex].setText("new text"); /*note that after the button is pressed, the control will no longer be a part of the WizardStep, and lastIndex won't reference the button's index anymore*/

另一个(不太好)的解决方案: 生成的按钮ID是id的{​​{1}}(不是Wizard)+ WizardStep。因此,如果您有一个向导-nextButton,则下一个按钮将始终为__xmlview13--myWizard,您可以使用__xmlview13--myWizard-nextButton然后使用sap.ui.getCore().byId(nextButtonId)等获取

这两种解决方法只是一种临时解决方案,按下后按钮文本更改,因为您使用的是同一个.setText()实例。

答案 2 :(得分:0)

没有标准方法。这是我实现的方式。

步骤1.使用向导控件上的showNextButton =“ false”停用标准按钮。 步骤2.在每个WizardSteps的内容中,都有您自己的按钮(作为最后一个控件),其中包含必需的文本。 步骤3.在添加的自定义按钮的press事件中,进行验证(考虑使用API​​ validateStep)并调用向导控件的nextStep()API。