Dynamically assign button function in Dialog

115 views
Skip to first unread message

DavidT

unread,
Jun 22, 2012, 6:15:05 PM6/22/12
to jui...@googlegroups.com
First off just wanted to say how much I'm enjoying playing with Juice UI - really impressive and easy to use for a back-end developer like me who's never been that comfortable with client-side stuff.
 
I'm trying to figure out how I can assign a function to my dialog OK button at runtime. I have a reusable "Are you sure..." dialog, where I want to pass different messages and different confirmation functions. Is the best way to use jQuery .each on the button classes, find the match based on button caption, and then assign a click function?

Andrew Powell (appendTo)

unread,
Jul 2, 2012, 7:51:06 AM7/2/12
to jui...@googlegroups.com
You'll want to use the Buttons property of the Juice:Dialog http://juiceui.com/controls/dialog.

DavidT

unread,
Jul 5, 2012, 8:37:03 AM7/5/12
to jui...@googlegroups.com
OK - I'll investigate this further. I currently have it working by using jQuery to unbind the old click event and then bind the new function I pass in. It feels a little hacky though.
Reply all
Reply to author
Forward
0 new messages