Greetings!
I'm trying to sum the value of two fields and display the result on a third field:
The code should sum the values, insert the result in the totalPrice variable and display it on Console.
After that, the StateHasChanged( ) should render the dialog again and the third field should display the result.
The code works, the value is displayed but the third field doesn't show it.
Is it possible to render the modal again and show the value?
I'm sending the code for further informations.
I'd appreciate your help,
Thank you
|
<GridEvents OnActionComplete="OnActionComplete" TValue="OrdersDetails"></GridEvents>
public void OnActionComplete(ActionEventArgs<OrdersDetails> args)
{
//based on Add or Edit action disable the PreventRender
if (args.RequestType.Equals(Action.Add) || args.RequestType.Equals(Action.BeginEdit))
{
args.PreventRender = false;
}
} |
Hello, again! Thank you for you answer.
I'm using the Dialog edit mode, because editing directly on the grid is not a good option for me.
Is is possible to update the values of the SfNumericTextBox inside the Dialog?
|
<SfGrid @ref="Grid" DataSource="@GridData" Toolbar="@(new string[] {"Add", "Edit" ,"Delete","Update","Cancel" })">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Dialog">
<Template>
@{
var Order = (context as OrdersDetails);
}
<div>
<div class="form-row">
<div class="form-group col-md-6">
<SfNumericTextBox ID="OrderID" @bind-Value="@(Order.OrderID)" Enabled="@Check" FloatLabelType="FloatLabelType.Always" Placeholder="Order ID"></SfNumericTextBox>
</div>
<div class="form-group col-md-6">
<SfAutoComplete TItem="OrdersDetails" ID="CustomerID" @bind-Value="@(Order.CustomerID)" TValue="string" DataSource="@GridData" FloatLabelType="FloatLabelType.Always" Placeholder="Customer Name">
<AutoCompleteFieldSettings Value="CustomerID"></AutoCompleteFieldSettings>
</SfAutoComplete>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<SfNumericTextBox ID="Price" @bind-Value="@(Order.Price)" TValue="double?" FloatLabelType="FloatLabelType.Always" Placeholder="Price"></SfNumericTextBox>
</div>
<div class="form-group col-md-6">
<SfNumericTextBox ID="Qty" @bind-Value="@(Order.Qty)" ShowSpinButton="false" TValue="double?" FloatLabelType="FloatLabelType.Always" Placeholder="Quantity">
<NumericTextBoxEvents ValueChange="@((args)=>OnChange(args,Order))" TValue="double?"></NumericTextBoxEvents>
</SfNumericTextBox>
</div>
<div class="form-group col-md-6">
<SfNumericTextBox ID="Total" @bind-Value="@(Order.Total)" ShowSpinButton="false" TValue="double?" FloatLabelType="FloatLabelType.Always" Placeholder="Total Amount"></SfNumericTextBox>
</div>
. . . . .
</div>
</Template>
</GridEditSettings>
</SfGrid>
@code{
SfGrid<OrdersDetails> Grid { get; set; }
private Boolean Check = false;
public void OnChange(Syncfusion.Blazor.Inputs.ChangeEventArgs<double?> Args, OrdersDetails order)
{
order.Total = order.Price * Args.Value;
Grid.PreventRender(false);
}
|
Hi support,
thank you! I confirm that your last solution is perfect. I had a similar scenario, and I implemented your solution without any problems.
Regards
Paolo
Hi Paolo,
We are glad that the provided solution helped to solve the issue. Please get back to us for further assistance.
Regards,
Suganya Gopinath.