-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP : Cell Edit feature (Rapid editing)
- Loading branch information
1 parent
47c5759
commit a7db301
Showing
8 changed files
with
132 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
Demos/Blazorise.Demo/Pages/Tests/DataGrid/EditingRapidPage.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@page "/tests/datagrid/editing/rapid-editing" | ||
<Row> | ||
<Column> | ||
<Card Margin="Margin.Is4.OnY"> | ||
<CardHeader> | ||
<CardTitle>Datagrid: Rapid Editing</CardTitle> | ||
</CardHeader> | ||
<CardBody> | ||
<Paragraph> | ||
Allows you to edit the cell value directly by clicking on it. | ||
</Paragraph> | ||
</CardBody> | ||
<CardBody> | ||
<DataGrid TItem="Employee" | ||
Data="inMemoryData" | ||
Responsive | ||
ShowPager | ||
ShowPageSizes | ||
@bind-SelectedRow="@selectedEmployee" | ||
Editable | ||
EditMode="@DataGridEditMode.Cell"> | ||
<DataGridColumns> | ||
<DataGridCommandColumn TItem="Employee"></DataGridCommandColumn> | ||
<DataGridColumn TextAlignment="TextAlignment.Center" TItem="Employee" Field="@nameof( Employee.Id )" Caption="#" Width="60px" /> | ||
<DataGridColumn TItem="Employee" Field="@nameof( Employee.FirstName )" Caption="First Name" Editable /> | ||
<DataGridColumn TItem="Employee" Field="@nameof( Employee.LastName )" Caption="Last Name" Editable /> | ||
<DataGridColumn TItem="Employee" Field="@nameof( Employee.Email )" Caption="Email" Editable /> | ||
<DataGridColumn TItem="Employee" Field="@nameof( Employee.City )" Caption="City" Editable> | ||
<CaptionTemplate> | ||
<Icon Name="IconName.City" /> @context.Caption | ||
</CaptionTemplate> | ||
</DataGridColumn> | ||
<DataGridColumn TItem="Employee" Field="@nameof( Employee.Zip )" Caption="Zip"> | ||
</DataGridColumn> | ||
<DataGridDateColumn TItem="Employee" Field="@nameof( Employee.DateOfBirth )" DisplayFormat="{0:dd.MM.yyyy}" Caption="Date Of Birth" Editable /> | ||
<DataGridNumericColumn TItem="Employee" Field="@nameof( Employee.Childrens )" Caption="Childrens" Editable Filterable="false" /> | ||
<DataGridSelectColumn TItem="Employee" Field="@nameof( Employee.Gender )" Caption="Gender" Editable Data="EmployeeData.Genders" ValueField="(x) => ((Gender)x).Code" TextField="(x) => ((Gender)x).Description" /> | ||
<DataGridColumn TItem="Employee" Field="@nameof( Employee.Salary )" Caption="Salary" Editable Width="140px" DisplayFormat="{0:C}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" TextAlignment="TextAlignment.End"> | ||
</DataGridColumn> | ||
<DataGridCheckColumn TItem="Employee" Field="@nameof(Employee.IsActive)" Caption="Active" Editable Filterable="false"> | ||
<DisplayTemplate> | ||
<Check TValue="bool" Checked="context.IsActive" Disabled ReadOnly /> | ||
</DisplayTemplate> | ||
</DataGridCheckColumn> | ||
</DataGridColumns> | ||
</DataGrid> | ||
</CardBody> | ||
</Card> | ||
</Column> | ||
</Row> | ||
|
||
@code { | ||
|
||
[Inject] EmployeeData EmployeeData { get; set; } | ||
|
||
private List<Employee> inMemoryData; | ||
private Employee selectedEmployee; | ||
private DataGridEditMode editMode = DataGridEditMode.Form; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
inMemoryData = ( await EmployeeData.GetDataAsync().ConfigureAwait( false ) ).Take( 25 ).ToList(); | ||
await base.OnInitializedAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters