Custom button onclick takes effect on onmouseout

4817
13
Jump to solution
11-28-2018 01:39 PM
ElizabethMiller
New Contributor III

I have a custom panel widget in WAB Developer edition. On the panel is a dijit/form/Button. It has a css class that gives it a color. It also has a label "Start Tool." There is a data-dojo-attach-event = "onClick:mytogglefunction."

In my widget code I have mytogglefunction, which uses an if/else pattern to look for the label state and change it to a different label "Stop Tool" and also change the css class (so button gets a different color when clicked and activated.)

Problem: user clicks once on button. Label changes immediately onclick, but css color doesn't change until the mouse pointer rolls off the button. So there are essentially 2 events happening -- the click, then the onmouseout. 

As I understand it, this is not a css :hover problem. I want the css to update on one onclick.

I created a similar button in a CMV application that worked fine -- but I don't know what is controlling this behavior in WAB.

Help! Thank you!

Tags (1)
0 Kudos
13 Replies
RobertScheitlin__GISP
MVP Emeritus

I am not sure what difference setting the baseclass and the dom nodes class make but I am glad you got it working.

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos
ElizabethMiller
New Contributor III

Thank you for helping me once again!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sure thing. Just some forum etiquette though when someone provides a reply that is helpful you should mark it as such. Since my replies did not produce the correct answer for you, marking your own is ok.

0 Kudos
ElizabethMiller
New Contributor III

Of course! I couldn't have solved this without your answer. Since I can't mark 2 answers, I have changed the mark.

0 Kudos