How to bind Jquery dialog buttons to a knockout viewmodel

前端 未结 2 1694
野的像风
野的像风 2021-02-10 09:56

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

2条回答
  •  你的背包
    2021-02-10 10:46

    To add on to Andrew's answer, since the data-bind attribute is just another attribute you can add to your buttons, this would also work:

    $("#dialog").dialog({
        buttons: [{
            text: 'Ok',
            'data-bind': 'visible: name().length'
        }]
    });
    

提交回复
热议问题