I have a simple HTML table which is bound using knockoutJS. However, I've added a custom binding which applies the jquery datatable plugin on the table.
When I click the headers, the table disappears. Any idea how I can get it working with knockoutJS?
This is the way to do it... I have made a jsfiddle showing this:
Here is a knockout custom binding solution for jQuery datatables.
JSFiddle w/ jqueryUI
Its actually unnecessary to use knockoutJs to carry out the binding of the dataTable. As knockoutJs already binds the HTML table to the model, just use the following:
The crucial part is to destroy the existing dataTable before the mapping, and re-create after mapping. I had to keep a reference to the initial dataTable for later destroying...