I am using the french localization and there is comma instead of dot for decimal values. I have used localization to display the values in french but at the time of inline editing i am not able to enter the comma for decimal value. Also in inline editing of the grid i am not able to edit the time value.
I need to map the values in the view model only not the database store. Here is my code.
<SfGrid @ref="EmployeeGrid" DataSource="@_employeeViewModels" GridLines="GridLine.Both" AllowResizing="true" AllowSelection="false" Locale="fr">
<GridEditSettings AllowEditing="true"></GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(EmployeeViewModel.Reference) Width="350" HeaderText="Collaborateur" IsPrimaryKey="true">
<Template>
@{
EmployeeViewModel employee = (context as EmployeeViewModel);
<div @onclick:stopPropagation="true">
<a rel='nofollow' href="#" @onclick="@(() => EditEmployee(employee.Reference))" @onclick:preventDefault>@employee.Reference</a>
</div>
}
</Template>
</GridColumn>
<GridColumn Field=@nameof(EmployeeViewModel.PreferenceZoneProductivity) TextAlign="TextAlign.Center" Width="180" HeaderText="Prod zone préférence" AllowEditing="true" EditType="EditType.NumericEdit"></GridColumn>
<GridColumn Field=@nameof(EmployeeViewModel.AllowedZoneProductivity) TextAlign="TextAlign.Center" Width="180" HeaderText="Prod zone autorisée" AllowEditing="true" EditType="EditType.NumericEdit"></GridColumn>
<GridColumn Field=@nameof(EmployeeViewModel.StartTime) Width="150" HeaderText="Heure de début" AllowEditing="true" ></GridColumn>
<GridColumn Field=@nameof(EmployeeViewModel.EndTime) Width="150" HeaderText="Heure de fin" AllowEditing="true" ></GridColumn>
<GridColumn Field=@nameof(EmployeeViewModel.ZonePreferences) Width="150" HeaderText="Zones de préférence" AllowEditing="false"></GridColumn>
<GridColumn Field=@nameof(EmployeeViewModel.ZoneAllowed) Width="150" HeaderText="Zones autorisées" AllowEditing="false"></GridColumn>
<GridColumn Width="50px" HeaderText="">
<Template>
@{
EmployeeViewModel employee = (context as EmployeeViewModel);
<div @onclick:stopPropagation="true">
<a rel='nofollow' href="#" @onclick="@(() => DeleteEmployee(employee.Reference))" @onclick:preventDefault>
<span class="oi oi-trash"></span>
</a>
</div>
}
</Template>
</GridColumn>
</GridColumns>
</SfGrid>
View Model
public class EmployeeViewModel
{
public int Order { get; set; }
public string Reference { get; set; }
public string ZonePreferences { get; set; }
public string ZoneAllowed { get; set; }
public Time StartTime { get; set; }
public Time EndTime { get; set; }
public double PreferenceZoneProductivity { get; set; } = 1;
public double AllowedZoneProductivity { get; set; } = 1;
public string Color { get; set; }
}
|
<GridColumn Field=@nameof(EmployeeViewModel.StartTime) Width="150" Format="hh:mm tt" HeaderText="Heure de début" AllowEditing="true">
<EditTemplate>
<SfTimePicker ID="StartTime" TValue="DateTime?" @bind-Value="@((context as EmployeeViewModel).StartTime)"></SfTimePicker>
</EditTemplate>
</GridColumn> |