on 02-06-2019 1:11 PM
Hello Experts,
In our scenario we have 6 buttons that based on some condition, some of them should be visible.
For example, in some cases we need to see just first and third button but the position should not be fix.
Can anyone help me how can we create or handle dynamic scanerio in sap design studio?
Thanks
Sepide
Hello Sepide,
It is possible with text boxes as buttons and dynamically hiding and showing based on your logic. Text in each button and corresponding action can be adjusted with SetText() so in your example, Text box in position 2 can have text of position 3 and text boxes of position 3 and 4 can be hidden.
Regards,
Nikhil Joy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil,
Thanks for your reply,
I am not sure if I got your point.
You mean instead of Button, I need to inser Text Components (in my case 4 Text)
and then
if case 1{
Text1.setText() = "MyText";
Text2.setText()= "MyseconText"
...
}
I did not understand the advantage of TextComponents instead of Button in this case. since also whith Button I can set the text manually.
And also what about the logics of each text?
In every TextComponent I need to say:
If this.getSeelectedText== "MyText"{
do Related action
)
else if this.getSelectedText== "MyText2"{
Do another action
}
You mean this?
This is not dynamic from my point of view.
Thanks
Sepide
Hi Sepide,
I prefer text box over buttons in these scenarios because of its flexibility to apply CSS. You are right, you can do it with buttons.
If you selectively hide unwanted buttons and exchange the text in it to near by buttons, it is not dynamic from a user perspective ?
I don't know what is your conditions. but as an example, if you want button1 and button3 visible in one case, you don't need a blank space of button2 in between, instead you want to see button3 in the place of button2 and hide remaining 2 last buttons. this is my understanding about your requirement. In this case if you dynamically assign text of button3 to button2 and hide buttons in position 3 and 4, it works dynamic in my opinion. as you mentioned already, based on getSelectedText() you can control the action also dynamically.
If you do not have many such conditions, you can try dynamically hiding and showing multiple sets of buttons in different panels too.
Correct me if my understanding is wrong.
Regards,
Nikhil Joy
Hi Nikhil,
Yes Exactly that is my requirement! your suggestion gave me an idea!
I used "ComponentManager" and get all my Buttons and then based on my condition as you suggest I used SetText of each button dynamically.
I do not find any other solution better than this.
Thanks for your help
Sepide
If you update to Lumira 2.x you could consider using dynamic components, blogged here by David Stocker: https://blogs.sap.com/2017/12/18/dynamic-components/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.