Skip to content

Commit

Permalink
Merge pull request #1 from Backiaraj/grid
Browse files Browse the repository at this point in the history
Update the project
  • Loading branch information
rajendranr-5483 committed Oct 13, 2023
2 parents bfa8606 + f76183f commit 1465e87
Show file tree
Hide file tree
Showing 48 changed files with 540 additions and 430 deletions.
6 changes: 4 additions & 2 deletions RealTimeSearch/RealTimeSearch/App.razor → App.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using System;

namespace RealTimeSearch.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public DateOnly Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string Summary { get; set; }
public string? Summary { get; set; }
}
}
}
20 changes: 20 additions & 0 deletions Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace RealTimeSearch.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@page "/counter"

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p>Current count: @currentCount</p>
<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

Expand Down
42 changes: 42 additions & 0 deletions Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page
@model RealTimeSearch.Pages.ErrorModel

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>

<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>

</html>
27 changes: 27 additions & 0 deletions Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;

namespace RealTimeSearch.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@page "/fetchdata"

@using RealTimeSearch.Data
@inject WeatherForecastService ForecastService

<PageTitle>Weather forecast</PageTitle>

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from a service.</p>
Expand Down Expand Up @@ -37,10 +38,10 @@ else
}

@code {
private WeatherForecast[] forecasts;
private WeatherForecast[]? forecasts;

protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
}
}
18 changes: 6 additions & 12 deletions ...meSearch/RealTimeSearch/Pages/Index.razor → Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
@page "/"

@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.Grids
@using Syncfusion.EJ2.Blazor.Navigations
@using Syncfusion.EJ2.Blazor.Inputs


<EjsGrid ModelType="@Model" DataSource="@Orders" AllowPaging="true" Height="200" @ref="Grid">
<EjsToolbar>
<SfGrid DataSource="@Orders" AllowPaging="true" Height="200" @ref="Grid">
<SfToolbar>
<ToolbarItems>
<ToolbarItem Align="ItemAlign.Right" Type="ItemType.Input">
<Template>
Expand All @@ -18,23 +12,23 @@
</Template>
</ToolbarItem>
</ToolbarItems>
</EjsToolbar>
</SfToolbar>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</EjsGrid>
</SfGrid>
<style>
.e-input-group-icon:before {
font-family: e-icons;
}
</style>
@code{
EjsGrid<Order> Grid;
SfGrid<Order> Grid;
public List<Order> Orders { get; set; }
Order Model = new Order();


public void OnInput(Microsoft.AspNetCore.Components.ChangeEventArgs Args)
{
Expand Down
36 changes: 36 additions & 0 deletions Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@page "/"
@using Microsoft.AspNetCore.Components.Web
@namespace RealTimeSearch.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="RealTimeSearch.styles.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
<component type="typeof(App)" render-mode="ServerPrerendered" />

<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

<script src="_framework/blazor.server.js"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using RealTimeSearch.Data;
using Syncfusion.Blazor;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSyncfusionBlazor();
builder.Services.AddSingleton<WeatherForecastService>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53213",
"sslPort": 44307
"applicationUrl": "http://localhost:35408",
"sslPort": 44351
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5215",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"RealTimeSearch": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7169;http://localhost:5215",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# EJ2-DataGrid-Grid-RealTimeSearch
In this demo, we have performed real time search in grid while typing a text in input box.
# Blazor DataGrid - Real Time Search

This sample explains about how to perform with real time search in Blazor DataGrid.

## Prerequisites

* Visual Studio 2022

## How to run the project

* Checkout this project to a location in your disk.
* Open the solution file using the Visual Studio 2022.
* Restore the NuGet packages by rebuilding the solution.
* Run the project.
16 changes: 16 additions & 0 deletions RealTimeSearch.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Blazor.Grid" Version="23.1.38" />
<PackageReference Include="Syncfusion.Blazor.Inputs" Version="23.1.38" />
<PackageReference Include="Syncfusion.Blazor.Navigations" Version="23.1.38" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.38" />
</ItemGroup>

</Project>
16 changes: 8 additions & 8 deletions RealTimeSearch/RealTimeSearch.sln → RealTimeSearch.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.138
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealTimeSearch", "RealTimeSearch\RealTimeSearch.csproj", "{1FB6D993-CCEB-4985-B54B-1C7589C7AFCB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealTimeSearch", "RealTimeSearch.csproj", "{322A43D0-EF7F-4E74-B82A-F0997FC773CE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1FB6D993-CCEB-4985-B54B-1C7589C7AFCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FB6D993-CCEB-4985-B54B-1C7589C7AFCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FB6D993-CCEB-4985-B54B-1C7589C7AFCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FB6D993-CCEB-4985-B54B-1C7589C7AFCB}.Release|Any CPU.Build.0 = Release|Any CPU
{322A43D0-EF7F-4E74-B82A-F0997FC773CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{322A43D0-EF7F-4E74-B82A-F0997FC773CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{322A43D0-EF7F-4E74-B82A-F0997FC773CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{322A43D0-EF7F-4E74-B82A-F0997FC773CE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A21E72EC-A487-49F2-831C-35D6EC58219E}
SolutionGuid = {0EA14B77-8077-4756-A44F-2EDDDEDA3AEE}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 1465e87

Please sign in to comment.