BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
How to add many parameters (for example, two parameters id=2 and str='23') to a method RemoveAsync in
DataManager?
Hi Kavit,
Thank you for reaching out to Syncfusion support.
We have already discussed your requirement in our documentation, which can be accessed from the below link,
Documentation: https://blazor.syncfusion.com/documentation/datagrid/custom-binding#how-to-pass-additional-parameters-to-custom-adaptor
Please let us know if you have any concerns.
Regards,
Naveen Palanivel
Query, only for method ReadAsync.
Hi Kavit
Sorry for the delay,
We have reviewed your request and understood that you would like to pass a query to the RemoveAsync method in DataManager. To better meet your requirements, we recommend creating a Custom Adaptor as a separate component and passing the query as a parameter to the RemoveAsync method. For more details on how to create a custom Adaptor, please refer to the following documentation
Documentation : https://blazor.syncfusion.com/documentation/datagrid/custom-binding#custom-adaptor-as-component
Please let us know if you have any concerns.
Regards,
Naveen Palanivel
In method insert, come Only one parameter, primary key, in value object.
Hi Kavit,
Sorry for the delay in getting back to you.
Query: “In method insert, come Only one parameter, primary key, in value object.”
Once the CustomAdaptor component is defined as a component instead of a Class instance, then additional parameters can be sent to CustomAdaptor Ready, Insert, Remove or Update methods as Parameters and accessed inside it. Refer to the below code example.
<SfGrid TValue="Order" ID="Grid" AllowSorting="true" AllowFiltering="true" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })"> <SfDataManager Adaptor="Adaptors.CustomAdaptor"> <CustomAdaptorComponent Query="Qry"></CustomAdaptorComponent> </SfDataManager> <GridPageSettings PageSize="8"></GridPageSettings> <GridEditSettings AllowEditing="true" AllowDeleting="true" AllowAdding="true" Mode="@EditMode.Normal"></GridEditSettings> <GridColumns> <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Center" Width="140"></GridColumn> <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Width="150"></GridColumn> </GridColumns> </SfGrid>
@code {
public Query Qry { get; set; } = new Query().AddParams("id",2).AddParams("str","23");
}
……
[CustomAdaptorComponent.razor]
@code { [Parameter] [JsonIgnore] public RenderFragment ChildContent { get; set; }
[Parameter] public Query Query { get; set; }
. . . . . . . . // Performs Insert operation public override async Task<object> InsertAsync(DataManager dm, object value, string key) { //here you can access the query property var qry = Query; . . . . . . }
// Performs Remove operation public override async Task<object> RemoveAsync(DataManager dm, object value, string keyField, string key) { //here you can access the query property var qry = Query; . . . . . . . . return value; }
// Performs Update operation public override async Task<object> UpdateAsync(DataManager dm, object value, string keyField, string key) { //here you can access the query property var qry = Query; . . . . . . .
return value; } |
Kindly refer to the sample in the attachments for your reference.
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
Thank you. Your example helped me.