Question

When I use an array of custom jaydata objects the result is bizarre.

var arr = [];
arr.push(new Northwind.Employee());
arr.push(new Northwind.Employee());

var newarr = ko.mapping.fromJS(arr);

If the debug is observed, the variable newarr looks like an observable array. If you try to unwrap to expose the underlying array:

newarr()

you get "An unspecified error has occured."

To make things weirder, if you go a step further:

newarr()[0]

you are blessed with the first element of the array. Knockout bindings behave as expected, I just cannot perform array operations (length, push, pop) and that is critical.

I really need the mapping.fromJS as I'm dealing with large trees of objects and I'm baffled regarding how to proceed from here. Mapping behaves properly with POJO objects, but jaydata is a crucial piece to my puzzle as well. Can anyone help show me what I'm doing wrong?

Here is a fiddle with what I'm discussing. I can't get it to work but it at least gives a full context. http://jsfiddle.net/jpirok/AAEuM/

Thanks for your help!

Was it helpful?

Solution

This ended up being a non-issue. Thanks for the help and sorry it took me awhile to close this!

OTHER TIPS

I work for JayData. JayData support knockoutjs, we have lots of examples here: http://jaydata.org/examples/index.html

Have you included jaydatamodules/knockout.js?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top