Hi Team,
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/b/4/b491a501479eb15a283f131cb84487ea84d14a5e.png)
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/4/a/4aeca828f9a7163ac42777554603d9e42df548bd.png)
I have a Button1 as template in one view1 (Initially its background color is White)
In view 2- I have flex container- binded Button1 and one more Button2
View 3- is my Main View- View2 is binded
In Main View (view3)- On clicking on Button1-I am opening Popup.
In popup – on clicking on OK button, I am updating current time in database and also I need to change the Background color of Button1 depends on status column value in database.(If status=1 green(fromStyleCSS) else red)
Script on Button1
system.perspective.openPopup("sampleform", 'Page/popup',params = {'param1’:value})
script on OK button:
updating query.
Created param for background color.
Here How to change the background color of Button1 by using the style CSS created in Button1(View1).
I tried with passing the parameter in popup for background color but not getting the result.
Please guide.
Use Component Message Handlers.
Read the docs and watch the videos.
Thank you.
I have tried this Message Handler method in other screens.
But here already I am passing parameter in popup, so I want to know how we can use in this.
If I understand your question, your situation is this:
View1 [Main]
+ View2
+ Embedded View: View 1
+ Button1
+ Button 1 - opens popup
+ Button 2
Popup
+ OK_button - needs to change View2/Button1 background color.
You seem to be trying to pass a value from Popup back to View1/View2/Button1. You can't pass values back through parameters. They are read only.
The correct way to do this is via message handling.
If my project tree is not correct then please clarify.
View1 - Button1
View2- Flexrepeater - View1:Button1
Testpage - View2 - Button1-openPOPup
on popup- Ok button- on click event- change the background color of Button1.
Thanks.
The indentation to show the hierarchy - if you had any - would be lost in your post. You need to use the </> code formatting button. See Wiki - how to post code on this forum. Please edit your post to fix it.
Ok I will.
Can you please guide how we apply using MessageHandler or other method for background color change of button.
View1 - button1
clicking on button1- openpopup(view2)
on popup - OK button click event- change the background color of Button1 in view1
Thank you