|
<GridColumn Field="DESCRIPTION" HeaderText="Description" AllowEditing="false">
<EditTemplate>
<SfAutoComplete ID="DESCRIPTION" TValue="string" TItem="TblInvItems"
@bind-Value="@((context as InvFormDetail).DESCRIPTION)"
AllowFiltering="true"
IgnoreCase="true"
MinLength="3"
Placeholder="Select product">
<SfDataManager Url="inv/getinvitems" Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
<AutoCompleteFieldSettings Text="Itemdescription" Value="Itemdescription"></AutoCompleteFieldSettings>
<AutoCompleteEvents TItem="TblInvItems" TValue="string"></AutoCompleteEvents>
</SfAutoComplete>
</EditTemplate>
</GridColumn>
|
Hi Martin,
Greetings from Syncfusion support.
Query 1 : During edit mode, there is an error , During edit, description column should not be shown, how to do it?We suggest you to disable the SfAutoComplete by checking for the RequestType as Add/BeginEdit in OnActionBegin event to achieve this requirement.
<GridEvents TValue="EMRAIRPRO.Shared.InvFormDetail"... OnActionBegin="OnActionBegin" ... ></GridEvents> <GridColumn Field="DESCRIPTION" HeaderText="Description" AllowEditing="false"> <EditTemplate> <SfAutoComplete ID="DESCRIPTION" ... Enabled="@AutoCompleteDisable"> ... </SfAutoComplete> </EditTemplate> </GridColumn> public bool AutoCompleteDisable { get; set; } public void OnActionBegin(ActionEventArgs<EMRAIRPRO.Shared.InvFormDetail> args) { if (args.RequestType.Equals(Action.Add)) { AutoCompleteDisable = true; } else if (args.RequestType.Equals(Action.BeginEdit)) { AutoCompleteDisable = false; } }
Note : The Cell based events(OnCellSave, OnCellEdit) will be triggered only when using Batch mode of editing in Grid.
Query 2 : How to properly bind sfatucomplete value to modelWe suggest you to ensure to provide proper values for the properties of SfAutoComplete based on the type of column in which you are using SfAutoComplete. As the DESCRIPTION field is a string typed field, we suggest you to define SfAutoComplete based on the string valued column.Please refer the highlighted codes below,
<GridColumn Field="DESCRIPTION" HeaderText="Description" AllowEditing="false"><EditTemplate><SfAutoComplete ID="DESCRIPTION" TValue="string" TItem="TblInvItems"@bind-Value="@((context as InvFormDetail).DESCRIPTION)"AllowFiltering="true"IgnoreCase="true"MinLength="3"Placeholder="Select product"><SfDataManager Url="inv/getinvitems" Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager><AutoCompleteFieldSettings Text="Itemdescription" Value="Itemdescription"></AutoCompleteFieldSettings><AutoCompleteEvents TItem="TblInvItems" TValue="string"></AutoCompleteEvents></SfAutoComplete></EditTemplate></GridColumn>
Please get back to us if you need further assistance.
Regards,Renjith Singh Rajendran
<GridColumn Field="DESCRIPTION" HeaderText="Description" AllowEditing="false">
<EditTemplate>
<SfAutoComplete ID="DESCRIPTION" ... Enabled="@AutoCompleteDisable">
...
<AutoCompleteEvents ... OnValueSelect="(e) => OnValueSelect(e, context as InvFormDetail)"></AutoCompleteEvents>
</SfAutoComplete>
</EditTemplate>
</GridColumn>
...
<GridColumn Field="PRICE" HeaderText="Price" Format="n2" TextAlign="TextAlign.Right">
<EditTemplate>
<SfNumericTextBox ID="PRICE" ... @bind-Value="@PRICEValue" />
</EditTemplate>
</GridColumn> |
Hi Martin,
Based on this scenario, we suggest you to set the value for a variable and assign this to the @bind-Value property of the component. And also ensure to handle the save in OnActionBegin event of Grid based on RequestType as Save. And also ensure to set PreventRender as false in OnActionComplete event hanlder based on RequestType as Add/BeginEdit. Please refer and use as like the codes below,
<GridEvents ... OnActionBegin="OnActionBegin" OnActionComplete="OnActionComplete"... ></GridEvents> <GridColumn Field="DESCRIPTION" HeaderText="Description" AllowEditing="false"><EditTemplate><SfAutoComplete ID="DESCRIPTION" ... Enabled="@AutoCompleteDisable">...<AutoCompleteEvents ... OnValueSelect="(e) => OnValueSelect(e, context as InvFormDetail)"></AutoCompleteEvents></SfAutoComplete></EditTemplate></GridColumn>...<GridColumn Field="PRICE" HeaderText="Price" Format="n2" TextAlign="TextAlign.Right"><EditTemplate><SfNumericTextBox ID="PRICE" ... @bind-Value="@PRICEValue" /></EditTemplate></GridColumn>public decimal? PRICEValue { get; set; } public decimal? NETPRICEValue { get; set; } public void OnValueSelect(SelectEventArgs<TblInvItems> e, InvFormDetail row) { PRICEValue = e.ItemData.Sellprice; NETPRICEValue = row.PRICE; } public void OnActionBegin(ActionEventArgs<EMRAIRPRO.Shared.InvFormDetail> args) { if (args.RequestType.Equals(Action.Save)) { //Hanlde the saving of the corresponding value here args.Data.PRICE = PRICEValue; args.Data.NETPRICE = NETPRICEValue; } ... } public void OnActionComplete(ActionEventArgs<EMRAIRPRO.Shared.InvFormDetail> args) { if(args.RequestType.Equals(Action.Add) || args.RequestType.Equals(Action.BeginEdit)) { args.PreventRender = false; } }
Query : I tried this: OnCellEdit,OnCellSaveAs informed in our previous update, the Cell based events(OnCellSave, OnCellEdit) will be triggered only when using Batch mode of editing in Grid. As you have used Normal edit mode in Grid, it is suggested to use Action events(OnActionBegin, OnActionComplete) for your requirement.
References :
Please get back to us if you need further assistance.
Regards,Renjith Singh Rajendran
Hi Martin,
Thanks for the update.
We are glad to hear that you have resolved your query using our solution.
Please get back to us if you have further queries.
Regards,Vignesh Natarajan
Hi Martin,
Thanks for the update.
We are glad to hear that you have resolved your query using our solution.
Please get back to us if you have further queries.
Regards,Vignesh Natarajan