javascript - Error extending entity with a observableArray in Breeze via constructor -
if try extend entity in breeze via constructor like:
breeze.entitymanager('serviceurl').metadatastore.registerentitytypector( 'customer', function () { this.orders = ko.observablearray([]); } );
i knockout error when trying set new properties:
mycustomer.orders(neworders);
the error is:
"cannot write value ko.computed unless specify 'write' option. if wish read current value, don't pass parameters."
the same work if add in post-construction initializer. doing wrong?
you missing required parameter -
breeze.entitymanager('serviceurl').metadatastore.registerentitytypector( 'customer', null, function () { this.orders = ko.observablearray([]); } );
your 'customer' parameter required identify entity type.
the second parameter constructor (not extending properties onto entity)
the third initializing entity
http://www.breezejs.com/sites/all/apidocs/classes/metadatastore.html#method_registerentitytypector
you need define entity in function -
breeze.entitymanager('serviceurl').metadatastore.registerentitytypector( 'customer', function (cust) { cust.orders = ko.observablearray([]); } );
Comments
Post a Comment