Skip to content

Commit ffd32ee

Browse files
Merge pull request #3 from SyncfusionExamples/982744-Grid
982744: GitHub sample updated from .net7b to .net8.
2 parents c845502 + 98f1bdd commit ffd32ee

36 files changed

+166
-1324
lines changed

App.razor

Lines changed: 0 additions & 12 deletions
This file was deleted.

Components/App.razor

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
9+
<link rel="stylesheet" href="app.css" />
10+
<link rel="stylesheet" href="DataGridGettingStartedSample.styles.css" />
11+
<link rel="icon" type="image/png" href="favicon.png" />
12+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
13+
<HeadOutlet @rendermode="InteractiveServer" />
14+
</head>
15+
16+
<body>
17+
<Routes @rendermode="InteractiveServer" />
18+
<script src="_framework/blazor.web.js"></script>
19+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
20+
</body>
21+
22+
</html>

Components/Layout/MainLayout.razor

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
5+
<main>
6+
<article class="content px-4">
7+
@Body
8+
</article>
9+
</main>
10+
</div>
11+
12+
<div id="blazor-error-ui">
13+
An unhandled error has occurred.
14+
<a href="" class="reload">Reload</a>
15+
<a class="dismiss">🗙</a>
16+
</div>

Shared/MainLayout.razor.css renamed to Components/Layout/MainLayout.razor.css

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,27 @@ main {
2121
align-items: center;
2222
}
2323

24-
.top-row ::deep a, .top-row .btn-link {
24+
.top-row ::deep a, .top-row ::deep .btn-link {
2525
white-space: nowrap;
2626
margin-left: 1.5rem;
27+
text-decoration: none;
2728
}
2829

29-
.top-row a:first-child {
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
3035
overflow: hidden;
3136
text-overflow: ellipsis;
3237
}
3338

3439
@media (max-width: 640.98px) {
35-
.top-row:not(.auth) {
36-
display: none;
37-
}
38-
39-
.top-row.auth {
40+
.top-row {
4041
justify-content: space-between;
4142
}
4243

43-
.top-row a, .top-row .btn-link {
44+
.top-row ::deep a, .top-row ::deep .btn-link {
4445
margin-left: 0;
4546
}
4647
}
@@ -63,8 +64,33 @@ main {
6364
z-index: 1;
6465
}
6566

67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
6673
.top-row, article {
6774
padding-left: 2rem !important;
6875
padding-right: 1.5rem !important;
6976
}
7077
}
78+
79+
#blazor-error-ui {
80+
background: lightyellow;
81+
bottom: 0;
82+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
83+
display: none;
84+
left: 0;
85+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
86+
position: fixed;
87+
width: 100%;
88+
z-index: 1000;
89+
}
90+
91+
#blazor-error-ui .dismiss {
92+
cursor: pointer;
93+
position: absolute;
94+
right: 0.75rem;
95+
top: 0.5rem;
96+
}

Components/Pages/Home.razor

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@page "/"
2+
3+
<SfGrid DataSource="@Orders" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="true">
4+
<GridPageSettings PageSize="10"></GridPageSettings>
5+
<GridColumns>
6+
<GridColumn Field="@nameof(Order.OrderID)" HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
7+
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
8+
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
9+
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
10+
</GridColumns>
11+
</SfGrid>
12+
13+
@code {
14+
15+
public List<Order>? Orders { get; set; }
16+
17+
protected override void OnInitialized ()
18+
{
19+
Orders = Enumerable.Range(1, 75).Select(x => new Order()
20+
{
21+
OrderID = 1000 + x,
22+
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
23+
Freight = 2.1 * x,
24+
OrderDate = DateTime.Now.AddDays(-x)
25+
}).ToList();
26+
base.OnInitialized();
27+
}
28+
public class Order
29+
{
30+
public int? OrderID { get; set; }
31+
public string? CustomerID { get; set; }
32+
public DateTime? OrderDate { get; set; }
33+
public double? Freight { get; set; }
34+
}
35+
}

Components/Routes.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Router AppAssembly="typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
4+
<FocusOnNavigate RouteData="routeData" Selector="h1" />
5+
</Found>
6+
</Router>
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
@using System.Net.Http
2-
@using Microsoft.AspNetCore.Authorization
3-
@using Microsoft.AspNetCore.Components.Authorization
2+
@using System.Net.Http.Json
43
@using Microsoft.AspNetCore.Components.Forms
54
@using Microsoft.AspNetCore.Components.Routing
65
@using Microsoft.AspNetCore.Components.Web
6+
@using static Microsoft.AspNetCore.Components.Web.RenderMode
77
@using Microsoft.AspNetCore.Components.Web.Virtualization
88
@using Microsoft.JSInterop
99
@using DataGridGettingStartedSample
10-
@using DataGridGettingStartedSample.Shared
11-
@using Syncfusion.Blazor
10+
@using DataGridGettingStartedSample.Components
1211
@using Syncfusion.Blazor.Grids

Data/WeatherForecast.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

Data/WeatherForecastService.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Syncfusion.Blazor.Grid" Version="23.1.38" />
11-
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.38" />
10+
<PackageReference Include="Syncfusion.Blazor.Grid" Version="31.1.21" />
11+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="31.1.21" />
1212
</ItemGroup>
1313

1414
</Project>

0 commit comments

Comments
 (0)