Update Record from Data Grid Fails

When updating a record from the Data Grid component, subsequent update attempts for the same record fail if the record has a null Navigation Property.

  • Data grid gets loaded with records using the getTable() method.

  • An update request is sent using ${Data} and ${Data.ID}

  • The successful update response includes expanded Navigation Properties. However if a navigation property is null the response includes a null value for that entity. This Null navigation property seems to create an issue for subsequent update requests.

  • The request Payload of subsequent update requests is different than that of the first successful update.

  • Attempting a second or subsequent update for this same record fails with

"The query specified in the URI is not valid. Could not find a property named 'Invoice' on type 'System.Collections.Generic.KeyValuePair_2OfString_Object'."

Where 'invoice' is the field for a null navigation property which was not there originally and only appeared after the initial update request.

Note:
I do not see this issue if I use the Form component. It appears that the FORM component handles the null navigation property and does not add any additional fields to subsequent update requests.

I am attaching an image from an excel workbook with captures of the request and response using both Form Component and Data Grid Component.

As always, your assistance is appreciated.

thanks,
michael

Hi Michael,

The problem is that the Invoice property is returned as null from the server after the first update. This could happen in one of two cases:

  1. The corresponding related item doesn't exist. But then subsequent updates wouldn't have failed.
  2. The Radzen datasource is out of sync with your database. This could happen if you change your database schema but do not infer the data source. I suspect this could be the case as I see InvoiceItem and Invoice properties that sound similar.

Please try inferring your data source again and see if this fixes the issue. If it doesn't you can send us your application and a copy of your DB (SQL script or backup) to info@radzen.com (as part of your Radzen Professional support plan).

@korchev
Thanks for the quick response.
Sending our entire database is a bit large. but I created a small subset that demonstrates the issue. I will sent this to info@radzen.com

the Datasource is in sync since I created the application this morning and no database changes were made. InvoiceItem and Invoice are two separate entities. Invoice is a navigation property and is in fact null for this record. InvoiceIDFK is the related key which is null therefore the Navigation property should return a null Invoice entity.

Latest release (Radzen 2.12.2) includes fix for this problem.

@enchev,
thanks to your team for the quick response.

1 Like

@enchev,
I am still having this issue when I use odata as my data source.

When my data source is MS Sql. An update from the data grid works. no navigation properties included in a patch operation.

however, when my data source is an odata api, the update from the grid fails. and I see navigation properties included in the patch operation.

does this make sense? can you test this on your end?

thanks,

michael

Do you mean that you are using an external OData API which isn't created from Radzen? If yes then you would need to update your code a bit. The OData API doesn't allow navigation properties in PATCH requests. Radzen currently generates code that strips those for MS SQL data sources but doesn't do that for third party OData API's.

@korchev,

The Odata API was built using Radzen .

however this was built before version 2.12. would it make a difference if I rebuilt the API with the latest version?

michael

Can you send us an up to date version of your application to info@radzen.com? We need to inspect the generated code as we are not sure why it works for one data source and doesn't work for the other.

@korchev,

I sent the application to Info.