-
Notifications
You must be signed in to change notification settings - Fork 0
GH(GH-3546):Prepare video for Adaptive UI Layout in Blazor DataGrid Component #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
53 changes: 43 additions & 10 deletions
53
Grid-AdaptiveLayout/Grid-AdaptiveLayout/Pages/Counter.razor
This file contains hidden or 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 |
|---|---|---|
| @@ -1,18 +1,51 @@ | ||
| @page "/counter" | ||
|
|
||
| <PageTitle>Counter</PageTitle> | ||
| @using Syncfusion.Blazor | ||
| @using Syncfusion.Blazor.Grids | ||
|
|
||
| <h1>Counter</h1> | ||
|
|
||
| <p role="status">Current count: @currentCount</p> | ||
|
|
||
| <button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
| <div style="position:relative; min-height: 500px;"> | ||
| <SfMediaQuery @bind-ActiveBreakPoint="activeBreakpoint"></SfMediaQuery> | ||
| @if (activeBreakpoint == "Small") | ||
| { | ||
| isAdaptive = true; | ||
| } | ||
| else | ||
| { | ||
| isAdaptive = false; | ||
| } | ||
| <SfGrid DataSource="@Orders" AllowSorting="true" AllowFiltering="true" EnableAdaptiveUI="@isAdaptive" RowRenderingMode="RowDirection.Vertical" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update", "Search" })" AllowPaging="true"> | ||
| <GridFilterSettings Type="@FilterType.Excel"></GridFilterSettings> | ||
| <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings> | ||
| <GridColumns> | ||
| <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" Width="80" ValidationRules="@(new ValidationRules{ Required= true })"></GridColumn> | ||
| <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="120"></GridColumn> | ||
| <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" Width="130"></GridColumn> | ||
| <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" Width="120"></GridColumn> | ||
| </GridColumns> | ||
| </SfGrid> | ||
| </div> | ||
|
|
||
| @code { | ||
| private int currentCount = 0; | ||
| public List<Order>? Orders { get; set; } | ||
| private string? activeBreakpoint { get; set; } | ||
| private bool isAdaptive { get; set; } | ||
|
|
||
| protected override void OnInitialized() | ||
| { | ||
| Orders = Enumerable.Range(1, 75).Select(x => new Order() | ||
| { | ||
| OrderID = 1000 + x, | ||
| CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], | ||
| Freight = 2.1 * x, | ||
| OrderDate = DateTime.Now.AddDays(-x), | ||
| }).ToList(); | ||
| } | ||
|
|
||
| private void IncrementCount() | ||
| public class Order | ||
| { | ||
| currentCount++; | ||
| public int? OrderID { get; set; } | ||
| public string? CustomerID { get; set; } | ||
| public DateTime? OrderDate { get; set; } | ||
| public double? Freight { get; set; } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| </div> | ||
| <div class="nav-item px-3"> | ||
| <NavLink class="nav-link" href="counter"> | ||
| <span class="oi oi-plus" aria-hidden="true"></span> Counter | ||
| <span class="oi oi-plus" aria-hidden="true"></span> AdaptiveUI with SfMediaQuery | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DataGrid Adaptive UI using Media Query
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the side bar name as DataGrid Adaptive UI using Media Query |
||
| </NavLink> | ||
| </div> | ||
| <div class="nav-item px-3"> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add intro title in page as
Enable/Disable DataGrid Adaptive UI using Media Query Component