Inline grid editing when editing one column automatically updates the values ​​in the other column

<SfGrid DataSource="@data" @ref="Grid" 
        Toolbar="@(new List<string>() { "Add", "Edit", "Cancel", "Update", "ExcelExport", "Search" })">
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal" ShowConfirmDialog="true" ShowDeleteConfirmDialog="true" AllowNextRowEdit="true"></GridEditSettings>
    <GridSearchSettings Operator="Syncfusion.Blazor.Operator.Contains" />
    <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings>
    <GridEvents OnActionBegin="ActionBeginHandle" OnActionComplete="ActionCompleteHandle" RowSelected="RowSeletedHandle" TValue="OperationLabour" ></GridEvents>
    <GridColumns>
        <GridColumn Field="@nameof(OperationLabour.Number)"
                    HeaderText="No."
                    TextAlign="@TextAlign.Right"
                    IsPrimaryKey="true"
                    Width="30">
            <EditTemplate>
                <SfNumericTextBox TValue="int" ID="Number" @bind-Value="@((context as OperationLabour).Number)" ShowSpinButton=false Enabled="false"></SfNumericTextBox>
            </EditTemplate>
        </GridColumn>
        <GridColumn Field="@nameof(OperationLabour.Code)"
                    HeaderText="Code"
                    TextAlign="@TextAlign.Left"
                    ValidationRules="@(new ValidationRules { Required = true, RegexPattern = OperationDetailObj.regexCode })"
                    Width="100">
            <EditTemplate>
                    <SfAutoComplete TItem="OperationLabour" TValue="string" ID="Code"  Value="@((context as OperationLabour).Code)" DataSource="@OperationDetailObj.LibraryCodes" ShowPopupButton="true">
                        <AutoCompleteFieldSettings Value="Code"></AutoCompleteFieldSettings>
                        <AutoCompleteEvents TValue="string" ValueChange="(args)=> {  CodeChangeHandle(args, ref context); }"/>
                    </SfAutoComplete>
            </EditTemplate>

        </GridColumn>
        <GridColumn Field="@nameof(OperationLabour.Feq)"
                    HeaderText="Feq."
                    TextAlign="@TextAlign.Right"
                    Width="40">
            <EditTemplate>
                    <SfNumericTextBox ID="Feq" TValue="float" Value="@((context as OperationLabour).Feq)" ShowSpinButton=false></SfNumericTextBox>
            </EditTemplate>

        </GridColumn>
    </GridColumns>
</SfGrid>
@code{
          protected void CodeChangeHandle(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string> args, ref object context)
        {
            var data = args.Value;

            Console.WriteLine(data);
            if (data != null){
                var editLabour = context as OperationLabour;
                editLabour.Code = data;
                 editLabour.Feq = data.Length;
            }
         }
}

Note: I want "Feq" to change automatically when "Code" has value change , this only work after I press enter or press button update

Can you guys provide me some answer here? Thanks a lot

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team November 9, 2020 12:02 PM UTC

Hi Truong, 

Greetings from Syncfusion support. 

We suggest you to call the PreventRender(false) inside the OnActionComplete event to achieve this requirement. Please add the below codes in your application to overcome this behavior. 

 
<GridEvents ... OnActionComplete="ActionCompleteHandle" ... TValue="OperationLabour"></GridEvents> 
 
public void ActionCompleteHandle(ActionEventArgs<OperationLabour> args){    if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.BeginEdit) || args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.Add))    {        Grid.PreventRender(false);    }}

Please refer the below documentation for more details, 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon