Knockout support. I don't see any significant Knockout support but maybe I'm missing something

Knockout support. I don't see any significant Knockout support but maybe I'm missing something

relentlesslylearningrelentlesslylearning Posts: 5Questions: 2Answers: 0

In the example in http://datatables.net/dev/knockout/ I can't see a single call to applyBindings. Given this is what binds KO observables and observableArrays to the elements we wish to see updated when our observables or observableArrays change I can't see how this example really uses Knockout (other than using some of the utils methods).

It's possible I've been spoiled with KO grid (which I'd be using if it was friendlier out of the box to bootstrap and wasn't pretty much dead as a project) but I was expecting some ability to bind my vm to the datatable and then, when the observableArray changed (via a push notification from signalR for example) the table to be updated. I'm happy to do some plumbing but it seems that I'd need to pretty much implement KO support myself rather than it being built into datatables.

I've seen KungFuCoder's forum post about extending Chris Mullins binding code but since Chris Mullins domain has disappeared off the net as of 9th January this year, I can't see his original article and so have no explanation other than the code in KungFuCoder's GitHub which is not enough I'm afraid for this not-so-smart developer.

Am I massively missing something? I'm no JS superdev and my understanding of KO is limited to getting a KOGrid implementation working (using as mentioned above signalR to push new records in realtime to the grid) and getting some other elements on pages to be updated via observables. If I am then I'd be really appreciative of someone giving me a bit of a starter where to look and how to start.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Am I massively missing something?

    Not at all - KO support just hasn't been a major priority for me as there are so many other things to do!

    I do have a custom foreach loop (dt-foreach) which I could send you and might be useful if you are looking for template support like that. But I haven't used KO much myself and therefore down have much experience with it.

    Any input from anyone for how to better implement KO integration is very welcome.

    The other thing I've also got in mind is the coming support for ECMAScript 6's observable objects which will make data binding super easy without another framework.

    Allan

  • relentlesslylearningrelentlesslylearning Posts: 5Questions: 2Answers: 0

    That's cool. I just wanted to make sure that I wasn't missing something really obvious. Work not done isn't work done wrong after all!

    I've actually found a reasonable solution here: http://brudtkuhl.com/easy-knockoutjs-pagination-data-tables/

    Like I said, I was spoiled by KoGrid and forgot about the ko foreach facility!

This discussion has been closed.