更改 WizardStep 按钮文本 [英] Change WizardStep button text

查看:34
本文介绍了更改 WizardStep 按钮文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何重命名每个 WizardStep 的按钮文本(默认为第 1 步"到第 n 步")?.

How can I rename the button text (default "step 1" till "step n") of each WizardStep?.

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

For the entire Wizard the text of the finish button can be set by setting the property finishButtonText. But there is no similar property for the WizardStep.

推荐答案

没有可靠、正确的方法来更改下一个按钮文本(我能找到).

There is no robust, proper way of changing the next button text (that I could find).

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

But here are two workarounds that might help while someone else gives a better answer:

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

The "next button" is the last control of the content of the current wizard step

myWizardStep.getContent()[lastIndex].setText("new text");/*注意按下按钮后,控件将不再是WizardStep的一部分,lastIndex将不再引用按钮的索引*/

另一个(不是很好)的解决方案:生成的按钮id是Wizardid(不是WizardStep)+-nextButton.因此,如果您有向导 __xmlview13--myWizard,下一个按钮将始终是 __xmlview13--myWizard-nextButton,您可以使用 sap.ui 获得.getCore().byId(nextButtonId)然后.setText()

Another (not great) solution: The generated id of the button is the id of the Wizard (not the WizardStep) + -nextButton. So if you have a wizard __xmlview13--myWizard, the next button will always be __xmlview13--myWizard-nextButton, which you can get using sap.ui.getCore().byId(nextButtonId)and then .setText(), etc.

这两种解决方法都只是临时解决方案,按钮文本在按下后发生变化,因为您使用的是 Button 的相同实例.

Both workarounds are just a temporary solution, and the button text will change after being pressed, because you are working with the same instance of Button.

这篇关于更改 WizardStep 按钮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆