There is a problem adding a new record while using Odata Expand

Below are the stages:

1. I am reading list from Odata service with ODataV4Adaptor.

2. Some columns in the grid are in the model dependent on the main model. Example: While showing the department list, I need to show the company name to which the department is affiliated.

            "Code": "Dept1",

            "Name": "Sample Department1",

            "Id": 11,

            "ReferenceCode": null,

            "IsActive": true,

            "Company": {

                "Name": "Main Company"

            }

3. With Odata Expand, I show the information I want in the column.

4. I have no problems with the update process.

5. In the process of adding a new record, the "Save" button does not trigger anything. If I press the "Cancel" button, the dialog screen closes.

6. If I use the company "ID" column instead of the company name in the department model, there is no problem in adding a new record.

7. I use Template for adding and updating new records.



3 Replies

RN Rahul Narayanasamy Syncfusion Team December 17, 2021 03:42 AM UTC

Hi Seckin, 

Greetings from Syncfusion. 

We have validated your query and you are facing while adding the record into the Grid. Whether did you used IsPrimaryKey column in the Grid. The Editing feature requires a primary key column for CRUD operations. Could you please ensure this case from your end? Please find the below code snippets for your reference. 


Also,  we need more details regarding the reported problem. Could you please share the below details. It will be helpful to validate and provide a better solution. 

  • Full Grid code snippets model class details.
  • Video demonstration of the problem.
  • Bind OnActionFailure event to the Grid and share the error details if you have received any errors.
  • Share a simple reproduceable sample if possible.

Regards, 
Rahul 
 



SK Seckin Karabacakoglu January 3, 2022 08:36 PM UTC

Thank you Rahul

I solved the problem. There was a problem with the setting of the primary key field. It is working correctly now.

Thanks again.



RN Rahul Narayanasamy Syncfusion Team January 4, 2022 12:54 PM UTC

Hi Seckin, 

Thanks for the update. 

We are happy to hear that the problem was resolved. Please get back to us if you need further assistance. 

Regards, 
Rahul 


Loader.
Up arrow icon