Open darianferrer opened 7 years ago
I think the fix is quite simple: in oDataProvider.js, line 742, value is an array, inside are the items with __convertedRefence, adding something like and a little refactoring would do the trick:
if(Array.isArray(value)){ for(var i = 0; i < value.length; i++){ // same process as line 746 } }
Hi,
I've a view where there is a form (category entity) and a list with inline edition (service entity). In my model, I define that Category has a collection of Service and also Service has a navigation property to Category. What I'm trying is to add the new category with its collection of service. The odata config is set with enableDeepSave = false and withReferenceMethods = true.
If I create a new category with one service, the batch request looks like this:
POST http://localhost:20300/odata/ProductServiceTypes HTTP/1.1 Content-ID: 1 Accept: application/json;q=0.9, /;q=0.1 OData-Version: 4.0 Content-Type: application/json OData-MaxVersion: 4.0
{"id":0,"createdById":0,"modifiedById":0,"dynamicProperties":{"displayName":{"en":"T"}}} --changeset_b91b-bbbe-e01c Content-Type: application/http Content-Transfer-Encoding: binary
POST http://localhost:20300/odata/ProductCategories HTTP/1.1 Content-ID: 2 Accept: application/json;q=0.9, /;q=0.1 OData-Version: 4.0 Content-Type: application/json OData-MaxVersion: 4.0
{"id":0,"productType":"General","canHaveSupplementsOrDiscounts":true,"canHaveContracts":true,"createdById":0,"modifiedById":0,"dynamicProperties":{"displayName":{"en":"T"}}} --changeset_b91b-bbbe-e01c Content-Type: application/http Content-Transfer-Encoding: binary
POST $2/services/$ref HTTP/1.1 If-Match: Content-ID: 3 Accept: application/json;q=0.9, /*;q=0.1 OData-Version: 4.0 Content-Type: application/json OData-MaxVersion: 4.0
{}
You can see one post for each entity and the last one would be the association between the two entities, but its body is empty. Debugging the oDataProvider.js, it seems that with a collection it cannot set the @odata.id property. Is there a way to solve this?