jquery ui dialog + knockoutjs
Having a problem getting the dialog to show; dialog retains 'display: none' property despite call to 'open'
by homer2
HTML
<script src="http://rniemeyer.github.com/KnockMeOut/Scripts/jquery.tmpl.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css">
<script src="https://raw.github.com/SteveSanderson/knockout/master/build/output/knockout-latest.debug.js"></script>
<button data-bind="click: toggle, text: isVisible()?'hide':'show'">toggle</button>
<button data-bind="click: show">show</button>
<button data-bind="click: hide" >hide</button>
<div data-bind="visible: isVisible">hide me</div>
<hr/>
<div data-bind="text: ko.toJSON($root)"></div>
JavaScript
var viewModel = {
isVisible: ko.observable(false),
toggle: function() {
this.isVisible(!this.isVisible());
},
show: function() {
this.isVisible(true);
},
hide: function() {
this.isVisible(false);
}
};
ko.applyBindings(viewModel);