Knockout Data Clearing on Sort or Search

Knockout Data Clearing on Sort or Search

jwhite81jwhite81 Posts: 1Questions: 1Answers: 0

I am having an issue with the DataTables plugin an KnockoutJS. When I populate the table with Knockout bindings the DataTable comes up perfectly. When you click sort or page it clears the tables and displays 'No data available in table'. Below is the knockout bindings I am using. Here is the actual data and the classes that we are using with the table bindings.

ViewModel = jQuery.parseJSON( "{"orders":[{"OrderID":11111111,"OrderStatusID":7,"OrderDate":"/Date(1401721692707)/","FirstName":"Evolv","LastName":"Master Distributor 4","Company":"","SubTotal":72,"ShippingTotal":9.75,"TaxTotal":"","Total":81.75,"CurrencyCode":"usd","WeightTotal":1.2,"BusinessVolumeTotal":40,"CommissionableVolumeTotal":60,"TrackingNumber1":"","TrackingNumber2":"","TrackingNumber3":"","TrackingNumber4":"","TrackingNumber5":"","ShippedDate":"/Date(-62135575200000)/"},{"OrderID":11111122,"OrderStatusID":7,"OrderDate":"/Date(1398288995000)/","FirstName":"Evolv","LastName":"Master Distributor 4","Company":"","SubTotal":10,"ShippingTotal":"","TaxTotal":"","Total":10,"CurrencyCode":"usd","WeightTotal":0.5,"BusinessVolumeTotal":"","CommissionableVolumeTotal":"","TrackingNumber1":"","TrackingNumber2":"","TrackingNumber3":"","TrackingNumber4":"","TrackingNumber5":"","ShippedDate":"/Date(-62135575200000)/"},{"OrderID":11111123,"OrderStatusID":7,"OrderDate":"/Date(1398288835000)/","FirstName":"Evolv","LastName":"Master Distributor 4","Company":"","SubTotal":10,"ShippingTotal":"","TaxTotal":"","Total":10,"CurrencyCode":"usd","WeightTotal":0.5,"BusinessVolumeTotal":"","CommissionableVolumeTotal":"","TrackingNumber1":"","TrackingNumber2":"","TrackingNumber3":"","TrackingNumber4":"","TrackingNumber5":"","ShippedDate":"/Date(-62135575200000)/"}]}");

EvolvCart.OrderHistory = function (OrderHistory) {
var self = this;
self.OrderID = ko.observable(OrderHistory.OrderID || '');
self.OrderStatusID = ko.observable(OrderHistory.OrderStatusID || '');
self.OrderDate = ko.observable(OrderHistory.OrderDate || '');
self.FirstName = ko.observable(OrderHistory.FirstName || '');
self.LastName = ko.observable(OrderHistory.LastName || '');
self.Company = ko.observable(OrderHistory.Company || '');
self.SubTotal = ko.observable(OrderHistory.SubTotal || '');
self.ShippingTotal = ko.observable(OrderHistory.ShippingTotal || '');
self.TaxTotal = ko.observable(OrderHistory.TaxTotal || '');
self.Total = ko.observable(OrderHistory.Total || '');
self.CurrencyCode = ko.observable(OrderHistory.CurrencyCode || '');
self.WeightTotal = ko.observable(OrderHistory.WeightTotal || '');
self.BusinessVolumeTotal = ko.observable(OrderHistory.BusinessVolumeTotal || '');
self.CommissionableVolumeTotal = ko.observable(OrderHistory.CommissionableVolumeTotal || '');
self.TrackingNumber1 = ko.observable(OrderHistory.TrackingNumber1 || '');
self.TrackingNumber2 = ko.observable(OrderHistory.TrackingNumber2 || '');
self.TrackingNumber3 = ko.observable(OrderHistory.TrackingNumber3 || '');
self.TrackingNumber4 = ko.observable(OrderHistory.TrackingNumber4 || '');
self.TrackingNumber5 = ko.observable(OrderHistory.TrackingNumber5 || '');
self.ShippedDate = ko.observable(OrderHistory.ShippedDate || '');

}

EvolvCart.OrderHistoryClass = function () {
var self = this;
self.orders = ko.observableArray();

}

EvolvCart.orderHistoryViewModel = new EvolvCart.OrderHistoryClass();

Order ID First Name Last Name Order Date Total
This discussion has been closed.