Using dataTables on a html table bound using KnockoutJS

Using dataTables on a html table bound using KnockoutJS

jonswainojonswaino Posts: 1Questions: 0Answers: 0
edited March 2012 in General
Has anyone had any success using dataTables with KnockoutJS?

I'm currently using it with a basic HTML table. Everything is fine with ko and the table but need to add sorting. So in the jquery dom ready event, I set dataTable() on the table element. This also works, but when I filter the table using a search feature, knockout updates the HTML table correctly with the reduced result set. However dataTable isn't aware so the table doesn't change. I think I need to get dataTables to see the underlying data object which dataTable is using has changed (in this case the HTML table itself).

How can I get dataTable to refresh? I've seen examples of setting dataTables against a specific data source, but I don't want to go this route as the ko binding to the table is working nicely.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Not something I've done yet myself, but this might be of some interest to you: http://jsfiddle.net/bdetchison/9BbgN/40/

    Allan
This discussion has been closed.