更改 WizardStep 按钮文本 [英] Change WizardStep button text
问题描述
如何重命名每个 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是Wizard
的id
(不是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屋!