knockout.observableDictionary icon indicating copy to clipboard operation
knockout.observableDictionary copied to clipboard

Customize ko.toJS for observableDictionary

Open jeanie77 opened this issue 6 years ago • 0 comments

I recently became a user and a big fan of knockout.observableDictionary library, I'm sorry it wasn't accepted as a part of knockout.

I noticed that observableDictionary has a toJSON customized function, which reassembles the javascript object, before sending it to the server. I would like toJS function to be customized as well, since the standard ko.toJS implementation converts the dictionary into a weird object, that isn't equivalent to the original passed to observableDictionary.

I opened the issue #2490 on knockout repository and someone suggested me to use Proxies. I think I can't easily adopt this solution, because I should write custom code to handle IE, every time a toJS function is invoked. I would like a more transparent solution. Do you have any ideas?

jeanie77 avatar Jul 24 '19 10:07 jeanie77