0

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

user2142786
  • 1,484
  • 9
  • 41
  • 74
  • What is reason to bind `$root` here `$root.applyRate.bind($root)`? – Ilya Sep 03 '14 at 13:02
  • Knockout uses JSON.stringify under the hood. See http://stackoverflow.com/questions/10392293/stringify-javascript-object-with-circular-reference for the solution – Robert Slaney Sep 04 '14 at 03:36

0 Answers0