Datatables and Knockout

Datatables and Knockout

urbanmichalurbanmichal Posts: 4Questions: 0Answers: 0
edited July 2013 in General
Hi guys,

I've got problem with integration Datatables with Knockout.

Below is the code or JS Fiddle: http://jsfiddle.net/3Mq2S/4/

PROBLEM:
When I'm clicking header there's no sorting and records are lost.

[code]

Change data



Index
Name










$(function() {

var $table = $('table');

var dtOptions = {
"aoColumns": [{
"sType": 'numeric'
}, {
"sType": 'string'
}, ],
};

var dt = $table.dataTable(dtOptions);

var vm = {};

vm.issues = ko.observableArray();

var counter = 0;

vm.changeData = function() {

vm.issues(
[{
id: counter,
name: 'a'
}, {
id: ++counter,
name: 'b'
}]);

++counter;
};

ko.applyBindings(vm, $('body')[0]);

vm.changeData();

});


[/code]

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    This thread might be of interest to you: http://datatables.net/forums/discussion/16160/knockout-observables-and-datatables-1.10-pre-beta-feedback-please
  • urbanmichalurbanmichal Posts: 4Questions: 0Answers: 0
    edited July 2013
    Allan, this is great. I remade your snippet for my data structure, but after second evaluating ko.mapping.fromJS I've got wrong data in datatable. JSFiddle: http://jsfiddle.net/BUDCL/

    I would be grateful for any ideas why it's not working :)
  • urbanmichalurbanmichal Posts: 4Questions: 0Answers: 0
    Problem solved :)
This discussion has been closed.