How can I bind a javascript dialog using Knockout?

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2012-04-02T21:39:14Z Indexed on 2012/04/02 23:29 UTC
Read the original article Hit count: 261

Filed under:
|

I've got a list of data in an observableArray and I want to show it in a javascript dialog window (I'm using jQuery.blockUI if it matters). Unfortunately the dialog seems to come unbound after the page is loaded. The dialog initializes correctly (the data is displayed), but it isn't updating with changes.

There are no Javascript errors and I've moved the binding to after the dialog is generated and added to the document (no effect). I've also tried calling ko.applyBinding on the main div that makes up the dialog but that, for some reason, causes part of the main page to hide (the DOM is there, but they are hidden).

EDIT: I've created a project on jsfiddle that reproduces the problem. The main culprit seems to be wrapping the content of the dialog in a div. If I show the content directly it seems to work (of course I can't do that, the wrappers provide a common style for our dialogs).

I'm recovering from the flu and could easily be missing something obvious, but I've been trying all day and nothing is coming to me. Any ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about knockoutjs