Skip to content

Commit 6307256

Browse files
Merge pull request #1 from Backiaraj/combobox
Update the project
2 parents 707e92b + 9167afb commit 6307256

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1712
-1693
lines changed

BlazorWASAM-Multi-Column.sln

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

Client/App.razor

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
2-
<Found Context="routeData">
3-
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4-
</Found>
5-
<NotFound>
6-
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
8-
</LayoutView>
9-
</NotFound>
10-
</Router>
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>

Client/BlazorWASAM-Multi-Column.Client.csproj

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

Client/BlazorWASAM-Multi-Column.Client.csproj.user

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.2" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" />
12+
<PackageReference Include="Syncfusion.Blazor.DropDowns" Version="23.1.39" />
13+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.39" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\Shared\MultiColumnComboBoxSample.Shared.csproj" />
18+
</ItemGroup>
19+
20+
</Project>

Client/Pages/Counter.razor

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
@page "/counter"
2-
3-
<h1>Counter</h1>
4-
5-
<p>Current count: @currentCount</p>
6-
7-
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
8-
9-
@code {
10-
private int currentCount = 0;
11-
12-
private void IncrementCount()
13-
{
14-
currentCount++;
15-
}
16-
}
1+
@page "/counter"
2+
3+
<PageTitle>Counter</PageTitle>
4+
5+
<h1>Counter</h1>
6+
7+
<p role="status">Current count: @currentCount</p>
8+
9+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
10+
11+
@code {
12+
private int currentCount = 0;
13+
14+
private void IncrementCount()
15+
{
16+
currentCount++;
17+
}
18+
}

Client/Pages/FetchData.razor

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,47 @@
1-
@page "/fetchdata"
2-
@using BlazorWASAM_Multi_Column.Shared
3-
@inject HttpClient Http
4-
5-
<h1>Weather forecast</h1>
6-
7-
<p>This component demonstrates fetching data from the server.</p>
8-
9-
@if (forecasts == null)
10-
{
11-
<p><em>Loading...</em></p>
12-
}
13-
else
14-
{
15-
<table class="table">
16-
<thead>
17-
<tr>
18-
<th>Date</th>
19-
<th>Temp. (C)</th>
20-
<th>Temp. (F)</th>
21-
<th>Summary</th>
22-
</tr>
23-
</thead>
24-
<tbody>
25-
@foreach (var forecast in forecasts)
26-
{
27-
<tr>
28-
<td>@forecast.Date.ToShortDateString()</td>
29-
<td>@forecast.TemperatureC</td>
30-
<td>@forecast.TemperatureF</td>
31-
<td>@forecast.Summary</td>
32-
</tr>
33-
}
34-
</tbody>
35-
</table>
36-
}
37-
38-
@code {
39-
private WeatherForecast[] forecasts;
40-
41-
protected override async Task OnInitializedAsync()
42-
{
43-
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
44-
}
45-
46-
}
1+
@page "/fetchdata"
2+
@using MultiColumnComboBoxSample.Shared
3+
@inject HttpClient Http
4+
5+
<PageTitle>Weather forecast</PageTitle>
6+
7+
<h1>Weather forecast</h1>
8+
9+
<p>This component demonstrates fetching data from the server.</p>
10+
11+
@if (forecasts == null)
12+
{
13+
<p><em>Loading...</em></p>
14+
}
15+
else
16+
{
17+
<table class="table">
18+
<thead>
19+
<tr>
20+
<th>Date</th>
21+
<th>Temp. (C)</th>
22+
<th>Temp. (F)</th>
23+
<th>Summary</th>
24+
</tr>
25+
</thead>
26+
<tbody>
27+
@foreach (var forecast in forecasts)
28+
{
29+
<tr>
30+
<td>@forecast.Date.ToShortDateString()</td>
31+
<td>@forecast.TemperatureC</td>
32+
<td>@forecast.TemperatureF</td>
33+
<td>@forecast.Summary</td>
34+
</tr>
35+
}
36+
</tbody>
37+
</table>
38+
}
39+
40+
@code {
41+
private WeatherForecast[]? forecasts;
42+
43+
protected override async Task OnInitializedAsync()
44+
{
45+
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
46+
}
47+
}

Client/Pages/Index.razor

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
@page "/"
2-
@using Syncfusion.Blazor
3-
@using Syncfusion.Blazor.DropDowns
4-
@using Syncfusion.Blazor.Data
5-
@using BlazorWASAM_Multi_Column.Shared;
6-
@inject HttpClient Http
7-
8-
<h1>Multi-column ComboBox!</h1>
9-
10-
Welcome to your new app.
11-
12-
<div id="ControlRegion">
13-
<div class="control-section col-lg-12">
14-
<div id="remote-data" class="col-lg-6">
15-
<div class="content">
16-
<SfComboBox @ref="selectProduct" TValue="string" TItem="Product" PopupWidth="700px" DataSource="@_productsList" PopupHeight="400px" CssClass="e-multi-column" Placeholder="Select a Product" AllowFiltering="true">
17-
<ComboBoxTemplates TItem="Product">
18-
<HeaderTemplate>
19-
<table><tr><th class="e-text-center">Product ID</th><th width="240px">Product Name</th><th>Unit Price</th><th>Units In Stock</th><th>Units On Order</th></tr></table>
20-
</HeaderTemplate>
21-
<ItemTemplate>
22-
<table><tbody><tr><td class="e-text-center">@((context as Product).ProductID)</td><td width="240px">@((context as Product).ProductName)</td><td>@((context as Product).UnitPrice)</td><td>@((context as Product).UnitsInStock)</td><td>@((context as Product).UnitsOnOrder)</td></tr> </tbody></table>
23-
</ItemTemplate>
24-
</ComboBoxTemplates>
25-
<ComboBoxFieldSettings Text="ProductName" Value="ProductID"></ComboBoxFieldSettings>
26-
<ComboBoxEvents TValue="string" TItem="Product" Filtering="OnFiltering"></ComboBoxEvents>
27-
</SfComboBox>
28-
</div>
29-
</div>
30-
</div>
31-
</div>
32-
33-
@code{
34-
35-
SfComboBox<string, Product> selectProduct;
36-
37-
private Product[] _productsList;
38-
39-
protected override async Task OnInitializedAsync()
40-
{
41-
_productsList = await Http.GetFromJsonAsync<Product[]>("Product");
42-
}
43-
// Filter event
44-
private async Task OnFiltering(FilteringEventArgs args)
45-
{
46-
//Prevent the default filtering action and make custom seacrh.
47-
args.PreventDefaultAction = true;
48-
var CustomSearch = new WhereFilter();
49-
var predicate = new List<WhereFilter>();
50-
// Add multiple predicate and make filter action in multiple columns.
51-
predicate.Add(new WhereFilter() { Condition = "or", Field = "ProductName", value = args.Text, Operator = "contains", IgnoreCase = true });
52-
predicate.Add(new WhereFilter() { Condition = "or", Field = "UnitPrice", value = args.Text, Operator = "contains", IgnoreCase = true });
53-
predicate.Add(new WhereFilter() { Condition = "or", Field = "UnitsInStock", value = args.Text, Operator = "contains", IgnoreCase = true });
54-
predicate.Add(new WhereFilter() { Condition = "or", Field = "UnitsOnOrder", value = args.Text, Operator = "contains", IgnoreCase = true });
55-
CustomSearch = WhereFilter.Or(predicate);
56-
var query = new Query().Where(CustomSearch);
57-
// call the FilterAsync public method and pass the data source and modified query.
58-
await selectProduct.FilterAsync(_productsList, query);
59-
}
60-
1+
@page "/"
2+
@using Syncfusion.Blazor
3+
@using Syncfusion.Blazor.DropDowns
4+
@using Syncfusion.Blazor.Data
5+
@using MultiColumnComboBoxSample.Shared;
6+
@inject HttpClient Http
7+
8+
<h1>Multi-column ComboBox!</h1>
9+
10+
Welcome to your new app.
11+
12+
<div id="ControlRegion">
13+
<div class="control-section col-lg-12">
14+
<div id="remote-data" class="col-lg-6">
15+
<div class="content">
16+
<SfComboBox @ref="selectProduct" TValue="string" TItem="Product" PopupWidth="700px" DataSource="@_productsList" PopupHeight="400px" CssClass="e-multi-column" Placeholder="Select a Product" AllowFiltering="true">
17+
<ComboBoxTemplates TItem="Product">
18+
<HeaderTemplate>
19+
<table><tr><th class="e-text-center">Product ID</th><th width="240px">Product Name</th><th>Unit Price</th><th>Units In Stock</th><th>Units On Order</th></tr></table>
20+
</HeaderTemplate>
21+
<ItemTemplate>
22+
<table><tbody><tr><td class="e-text-center">@((context as Product).ProductID)</td><td width="240px">@((context as Product).ProductName)</td><td>@((context as Product).UnitPrice)</td><td>@((context as Product).UnitsInStock)</td><td>@((context as Product).UnitsOnOrder)</td></tr> </tbody></table>
23+
</ItemTemplate>
24+
</ComboBoxTemplates>
25+
<ComboBoxFieldSettings Text="ProductName" Value="ProductID"></ComboBoxFieldSettings>
26+
<ComboBoxEvents TValue="string" TItem="Product" Filtering="OnFiltering"></ComboBoxEvents>
27+
</SfComboBox>
28+
</div>
29+
</div>
30+
</div>
31+
</div>
32+
33+
@code {
34+
35+
SfComboBox<string, Product> selectProduct;
36+
37+
private Product[] _productsList;
38+
39+
protected override async Task OnInitializedAsync()
40+
{
41+
_productsList = await Http.GetFromJsonAsync<Product[]>("Product");
42+
}
43+
// Filter event
44+
private async Task OnFiltering(FilteringEventArgs args)
45+
{
46+
//Prevent the default filtering action and make custom seacrh.
47+
args.PreventDefaultAction = true;
48+
var CustomSearch = new WhereFilter();
49+
var predicate = new List<WhereFilter>();
50+
// Add multiple predicate and make filter action in multiple columns.
51+
predicate.Add(new WhereFilter() { Condition = "or", Field = "ProductName", value = args.Text, Operator = "contains", IgnoreCase = true });
52+
predicate.Add(new WhereFilter() { Condition = "or", Field = "UnitPrice", value = args.Text, Operator = "contains", IgnoreCase = true });
53+
predicate.Add(new WhereFilter() { Condition = "or", Field = "UnitsInStock", value = args.Text, Operator = "contains", IgnoreCase = true });
54+
predicate.Add(new WhereFilter() { Condition = "or", Field = "UnitsOnOrder", value = args.Text, Operator = "contains", IgnoreCase = true });
55+
CustomSearch = WhereFilter.Or(predicate);
56+
var query = new Query().Where(CustomSearch);
57+
// call the FilterAsync public method and pass the data source and modified query.
58+
await selectProduct.FilterAsync(_productsList, query);
59+
}
60+
6161
}

0 commit comments

Comments
 (0)