Datatables and Knockout
Datatables and Knockout
urbanmichal
Posts: 4Questions: 0Answers: 0
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]
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]
This discussion has been closed.
Replies
I would be grateful for any ideas why it's not working :)