ODataV4 Edit Problems

As we already have 2 open threads on problems with SfDataManager, both of which are held on "please provide code sample", and we can't provide our complete code base, I've started a new simple code example to hopefully isolate.

Current Issues:

https://www.syncfusion.com/forums/172921/setting-pagesize-in-19-4-0-52-no-longer-working

https://www.syncfusion.com/forums/171965/failure-binding-to-odatav4

Please find attached simple project that opens a WASM Grid, retrieves the data, then fails on edit. Note: I think this problem is separate from the 2 above, and maybe I've made a mistake here, but this edit simply doesn't call the controller either.

So why is this edit failing?


Attachment: DemoFail_2_(Send)_d5360ae2.zip

3 Replies

RN Rahul Narayanasamy Syncfusion Team March 4, 2022 01:35 PM UTC

Hi Phil, 

Greetings from Syncfusion. 

Query: ODataV4 Edit Problems – controller not calling while saving  

We are able to reproduce the reported problem in the provided sample. In the shared sample, you have not defined the IsPrimaryKey in any one of the Grid columns. So while saving the record, the controller method was not called. Editing feature requires a primary key column for CRUD operations. You can resolve the reported case by providing IsPrimayKey to any one of the column whose value is unique. Find the below code snippets and sample for your reference. 

<SfGrid TValue="OrgUnit" AllowPaging="true" AllowFiltering=true AllowGrouping=true Toolbar="@ToolbarItems" > 
        <GridPageSettings PageSize="50"/> 
        <GridEditSettings AllowEditing="true" Mode="Syncfusion.Blazor.Grids.EditMode.Normal"/> 
        <SfDataManager Url="odata/OrgUnits" Adaptor="Adaptors.ODataV4Adaptor" Key="Id" /> 
        <GridEvents TValue="OrgUnit" OnActionFailure="@ActionFailure"></GridEvents> 
        <GridColumns> 
            <GridColumn Field="@nameof(ou.Id)" Width=120 IsPrimaryKey="true" IsIdentity="true" /> 
            <GridColumn Field="@nameof(ou.ParentId)" Width=100 /> 
        </GridColumns> 
    </SfGrid> 


Reference

If you are facing issues with the mentioned 2 forums, then share the issue details in those corresponding forums. The corresponding team will assist to resolve the problem. 

Please let us know if you have any concerns. 

Regards, 
Rahul 



PH Phil Holmes March 8, 2022 11:23 AM UTC

OK, thanks, yes, let's close this out. I was trying to isolate the CRUD issues having separately with the other SfTreeView / byte[] issue:

https://www.syncfusion.com/forums/171965/failure-binding-to-odatav4

But this one was my mistake.

May as well just delete this thread.



VN Vignesh Natarajan Syncfusion Team March 9, 2022 05:06 AM UTC

Hi Phil,  

Thanks for the update.  

We are glad to hear that you have resolved your query using our solution.  

Kindly get back to us if you have further queries. We will be very happy to assist you.  

Regards, 
Vignesh Natarajan. 


Loader.
Up arrow icon