Datatables with KnockoutJS do behave weird.

Datatables with KnockoutJS do behave weird.

brazorfbrazorf Posts: 2Questions: 0Answers: 0
edited October 2013 in General
Hello there,
first of all thank you for this awesome plugin.
I am quick-starting datatables and knockoutjs, ive read a lot about it, but still i can't make them work properly.

Basically this is what i'm doing
- i create the row template in html code, with KO foreach
- i make very basic column configuration and then i draw the table
so that any row is bound with an item from an observable array.

Problems occurr when
- i add a new element in the bound item
- i remove an element from the bound array

What's happening here is that rows are properly added and removed, but
in the very same moment i do add/remove them, the search field disappears
and columns are not clickable (for sorting) anymore.

If it's ok to you, i would like to link the stackoverflow question i recently opened, there are all details and code.
http://stackoverflow.com/questions/19469865/knockoutjs-with-jquery-datatables-bound-rows-are-not-updated-properly

Thank you

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    DataTables 1.9.4- will not work with knockout because of the way it is constructed. 1.10 however does work with KO observables using a method like this http://datatables.net/dev/knockout/ . Discussions about this, and that link, are findable by just search the forum for knockout.

    Allan
  • brazorfbrazorf Posts: 2Questions: 0Answers: 0
    edited October 2013
    Thanks,
    hasn't 1.10 been released yet, isn't it?
    Any workaround you can suggest to be used in 1.9, like for instance table destroy-rebuild?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited October 2013
    No it hasn't - it's pre-beta.

    I don't see any way it can be made to work in 1.9.4 since 1.9- copies the source data objects.

    Allan
This discussion has been closed.