We are building a Blazor WASM app. We have implemented the SfDataManager (along with OData) for the SFDataGrids we are using in our application. It is working well. We have other areas of our application where we require CRUD operations outside of a DataGrid. When we attempt to perform an operation, we are receiving the following error...
"Value cannot be null. (Parameter 'key')"
This seems to be related to the DataManager key property. I was looking at the custom binding (https://blazor.syncfusion.com/documentation/data/custom-binding) documentation and this seems to be the answer by extending/overriding the DataAdaptor class. Do you have an example that we can examine on how to utilize the SfDataManager outside of a DataGrid?
Additionally, if you feel this is not the issue we are facing with the above error, please let us know.
Hi Clay,
Greetings from Syncfusion support.
We have analyzed your query, before proceeding further with your requirement
kindly share the below details to validate further at our end.
The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.
Regards,
Sarvesh
Perhaps I did not explain myself completely. The DataManager is working well for our datagrids. We are wondering how to utilize it outside of datagrids. For example, if I have a form that requires a CRUD operation, can I use the DataManager? If so, how do I populate the key and other required items?
Hi Clay,
Query: if I
have a form that requires a CRUD operation, can I use the DataManager?
Yes, it is possible to use data manager outside grid and form as well. Kindly
refer the attached documentation links for more understanding of data manager
component.
Reference: https://blazor.syncfusion.com/documentation/data/getting-started
https://blazor.syncfusion.com/documentation/data/data-binding
https://blazor.syncfusion.com/documentation/data/adaptors
https://blazor.syncfusion.com/documentation/data/custom-binding
Regards,
Sarvesh
I have read through the documentation. I am not able to make DataManager work with EditForm. When my method from OnValidSubmit runs, it runs a method from a class where I extended the SyncFusion DataManager. It hits the method, but when I run the method, nothing gets posted to my API. Here is the code in question...
public async Task<Receipt> SaveReceipt(Receipt receipt)
{
Receipt retVar = (Receipt)await InsertAsync<Receipt>(receipt);
await JsRuntime.InvokeVoidAsync("console.log", retVar);
return retVar;
}
All that happens is my receipt object gets returned, but nothing hits my db. As far as the DataManager properties, I set those in the constructor of my class where I extend the DataManager.
Hi Clay,
Sorry for the inconvenience caused.
Query: “ I am not able to make DataManager work with EditForm. When my method from OnValidSubmit runs, it runs a method from a class where I extended the SyncFusion DataManager.”
We would like to confirm that the SfDataManager component can indeed be used to fetch data from an external service and display or bind it to your component. However, it is not possible to perform CRUD operations with the SfDataManager component when it is defined as a standalone component.
In this case, we recommend that you handle the CRUD operations directly in your service externally, using the OnValidSubmit event.
Also, we have considered it as a usability feature and logged a task “Provide support to handle CRUD operation in stand alone SfDataManager component". At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. And this improvement will be included in any of our upcoming releases.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
You can also communicate with us regarding the
open feature any time using our above feedback report page. We do not have
immediate plan to implement this feature and it will be included in any of our
upcoming releases. Please cast your vote to make it count. So that we will
prioritize the improvement for every release based on demands.
Please let us know if you have any further questions or if you need any additional information. We are here to help.
Regards,
Vignesh Natarajan