Converting circular structure to JSON in knockout

2019-03-05 15:43发布

I have two grid structure, In one of them I have multiple fields multiple times, whereas, in one I have two fields single time. I write apply method for each grid my first grid id working fine, but when I am clicking apply on second grid I am getting this error

Uncaught TypeError: Converting circular structure to JSON  

Here are both the apply methods:

self.applyRate = function (loan) {
    //  commit the edit transaction
    self.editTransaction.notifySubscribers(null, "commit");
    alert(ko.toJSON({data:loan}));
    //  hides the edit fields
    self.editingItem(null);
};
   self.apply = function (data) {
    //  commit the edit transaction
    self.editTransaction.notifySubscribers(null, "commit");
    alert(ko.toJSON({data:data}));
    self.editingItem(null);
};

applyRate() calls when I click on edit, and click the apply on first grid, i.e, loan.

I am getting problem while clicking apply for mandatory and benefits text field.

Here is a Js Fiddle Link: DEMO

0条回答
登录 后发表回答