What I mean by this is that the click callback functions we assign to a given dialog button exist in a void, it would seem. This is fine under most circumstances. Other times, we'd like to know the state of the dialog. Or perhaps the click event needs access to some arbitrary piece of application data — which isn't scoped globally.
What's interesting about these callback functions is that the
this
context is actually the dialog element, and not the button element as one might expect. Not a big deal, but it's nice when your callback wants to interact directly with the dialog, maybe by adding context to a query or by calling dialog widget methods. For example, if we wanted to pass some arbitrary application data to the dialog, we can do so — by passing it to the dialog options
object. It's then trivial to retrieve that data in the button click callbacks.
No comments :
Post a Comment