Converting circular structure to JSON in knockout js

淺唱寂寞╮ 提交于 2019-12-04 05:57:06

问题


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

来源:https://stackoverflow.com/questions/25637663/converting-circular-structure-to-json-in-knockout-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!