Using dataTables on a html table bound using KnockoutJS
Using dataTables on a html table bound using KnockoutJS
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.
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.
This discussion has been closed.
Replies
Allan