What I’d like to do is make a dialog where the buttons are databound to the knockout viewmodel so I can enable or disable those buttons depending on various conditions on the form
But the way you make buttons in jquery dialogs is a bit different than normal.
anyone have a solution for this?
Make sure to apply your own
classto the dialog’s buttons:Grab the
button.ok-buttonand apply adata-bindattribute to it (visiblehere, just to show you that it works). Here,nameis an observable property of our view model:Apply bindings normally:
Here’s an example that hide’s an “Ok” button on the dialog if
name(an observable) has a length> 0: http://jsfiddle.net/9cRFy/