Home > database >  blazorise numeric edit group separating
blazorise numeric edit group separating

Time:10-02

I'm trying to use blazorise numeric edit group separating attribute. as it is said in it's documentation it should be possible to use it, but as I tried, it's not working. I would appreciate it if you can help me to use blazorsie components to separate digits define thousands. for example, when I'm entering value 12345678, it shows 12,345,678 thanks in advance

CodePudding user response:

NumericEdit component does not have a GroupSeparator parameter. The GroupSeparator parameter is on the NumericPicker component:

<NumericPicker @bind-Value="@paymentDocumentCreateCommand.TotalPrice" GroupSeparator="," />

NumericPicker was added in Blazorise version 1.0.0.

NumericPicker vs NumericEdit

Workaround:

You can use the TextEdit component and apply a format when you convert the number to string.

<TextEdit @bind-Text="@TotalCost" />

<p>@_totalCost</p>

@code {
    private double _totalCost = 1234567890;

    private string TotalCost
    {
        get
        {
            return _totalCost.ToString("#,#");
        }
        set
        {
            _totalCost = string.IsNullOrEmpty(value) ? 0 : double.Parse(value);
        }
    }
}

Custom binding formats

You can create a custom input component that does this conversion internally.

  • Related