Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions samples/grids/pivot-grid/styling/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@using IgniteUI.Blazor.Controls

@inject IJSRuntime JS

<div class="container vertical ig-typography">
<div class="container vertical fill">
<IgbPivotGrid
Data="PivotSalesData"
Name="grid"
@ref="grid"
PivotConfiguration="PivotConfiguration1">
</IgbPivotGrid>
</div>
</div>

@code {
protected override async Task OnAfterRenderAsync(bool firstRender)
{
var grid = this.grid;
}

private IgbPivotGrid grid;
private IgbPivotConfiguration _pivotConfiguration1 = null;
public IgbPivotConfiguration PivotConfiguration1
{
get
{
if (this._pivotConfiguration1 == null)
{
var pivotConfiguration1 = new IgbPivotConfiguration();
var pivotDimension1 = new IgbPivotDimension();
pivotDimension1.MemberName = "Country";
pivotDimension1.Enabled = true;
pivotDimension1.Name = "pivotDimension1";pivotConfiguration1.Columns = [pivotDimension1];
var pivotDimension2 = new IgbPivotDimension();
pivotDimension2.MemberName = "Product";
pivotDimension2.Enabled = true;
pivotDimension2.Name = "pivotDimension2";pivotConfiguration1.Rows = [pivotDimension2];
var pivotValue1 = new IgbPivotValue();
pivotValue1.Member = "Sales";
pivotValue1.Enabled = true;
pivotValue1.Name = "pivotValue1";var pivotAggregator1 = new IgbPivotAggregator();
pivotAggregator1.Key = "MAX";
pivotAggregator1.AggregatorScript = "PivotSalesData";
pivotAggregator1.Name = "pivotAggregator1";pivotValue1.Aggregate = pivotAggregator1;
pivotConfiguration1.Values = [pivotValue1];

this._pivotConfiguration1 = pivotConfiguration1;
}
return this._pivotConfiguration1;
}
}

private PivotSalesData _pivotSalesData = null;
public PivotSalesData PivotSalesData
{
get
{
if (_pivotSalesData == null)
{
_pivotSalesData = new PivotSalesData();
}
return _pivotSalesData;
}
}
}
21 changes: 21 additions & 0 deletions samples/grids/pivot-grid/styling/BlazorClientApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>Infragistics.Samples</AssemblyName>
<RootNamespace>Infragistics.Samples</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702,IDE0028,BL0005,0219,CS1998</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IgniteUI.Blazor.Trial" Version="26.1.51" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" />
<PackageReference Include="System.Net.Http.Json" Version="10.0.1" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions samples/grids/pivot-grid/styling/BlazorClientApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorClientApp", "BlazorClientApp.csproj", "{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC52AAC8-4488-40AE-9621-75F6BA744B18}
EndGlobalSection
EndGlobal
1,068 changes: 1,068 additions & 0 deletions samples/grids/pivot-grid/styling/PivotSalesData.cs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions samples/grids/pivot-grid/styling/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using IgniteUI.Blazor.Controls; // for registering Ignite UI modules

namespace Infragistics.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbPivotGridModule)
);
await builder.Build().RunAsync();
}
}
}
27 changes: 27 additions & 0 deletions samples/grids/pivot-grid/styling/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4200",
"sslPort": 44385
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorSamples": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:4200"
}
}
}
68 changes: 68 additions & 0 deletions samples/grids/pivot-grid/styling/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
<!-- https://github.com/IgniteUI/igniteui-blazor-examples/tree/vnext/templates/sample/ReadMe.md -->

This folder contains implementation of Blazor application with example of Styling feature using [Pivot Grid](https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html) component.

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body>
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://dl.infragistics.com/x/img/browsers/button-docs.png"/>
</a>
<a target="_blank" href="./App.razor" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://dl.infragistics.com/x/img/browsers/button-code.png"/>
</a>
<a target="_blank" href="https://infragistics.com/blazor-client/samples/grids/pivot-grid/styling" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-run.png"/>
</a>
<!-- <a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-blazor-examples/tree/master/samples/grids/pivot-grid/styling?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/App.razor" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-sandbox.png"/>
</a> -->
</body>
</html>

## Branches

> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-blazor-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-blazor-examples/tree/vnext) branch only when you want to contribute new samples to this repository.

## Setup

- instal **.NET SDK** from this [website](https://dotnet.microsoft.com/learn/aspnet/blazor-tutorial/install)

## Running App in Visual Studio 2022

NOTE: VS 2022 has better code highlighting and error detection than VS Code does.

- open **Visual Studio 2022** as an administrator

- open the **BlazorClientApp.sln** solution

- right click solution and select **Restore NuGet Packages** menu item

- click **Debug** menu and select **Start Debugging** or press **F5** key


## Running App in VS Code

- open **VS Code** as an administrator

- open this folder in **VS Code**

- open a terminal window

- to restore assemblies, run this command:
```dotnet restore```

- to run samples, run this command:
```dotnet watch run```

- wait for for message:
**Now listening on: http://localhost:4200**

- open **http://localhost:4200** in your browser


## Resources

- [Razor Component Models](https://www.codemag.com/article/1911052)
- [Razor Syntax](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1#razor-syntax)
- [Getting reference to components](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1#capture-references-to-components)
9 changes: 9 additions & 0 deletions samples/grids/pivot-grid/styling/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// these namespaces are global to the app
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using Infragistics.Samples
9 changes: 9 additions & 0 deletions samples/grids/pivot-grid/styling/wwwroot/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


igRegisterScript("PivotSalesData", (members, data) => {
if (!data) {
return [];
}
return data.map(x => x.Sales).reduce((a, b) => Math.max(a, b));
}, false);

16 changes: 16 additions & 0 deletions samples/grids/pivot-grid/styling/wwwroot/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
CSS styles are loaded from the shared CSS file located at:
https://dl.infragistics.com/x/css/samples/shared.v6.css
*/

igc-pivot-grid {
--header-background: #3b3a3a;
--header-text-color: #ffcd0f;
--content-background: #494949;
--content-text-color: #ffcd0f;
--row-odd-background: #494949;
--row-even-background: #494949;
--row-hover-background: #3b3a3a;
--row-hover-text-color: #ffcd0f;
}

33 changes: 33 additions & 0 deletions samples/grids/pivot-grid/styling/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="description" content="Explore samples of IgniteUI for Blazor components.">
<meta name="keywords" content="Sample, Example, Blazor, IgniteUI for Blazor, Components, Infragistics">
<meta name="author" content="Infragistics">
<title>Samples | IgniteUI for Blazor | Infragistics</title>
<base href="/" />
<link href="https://dl.infragistics.com/x/img/browsers/blazor.ico" rel="icon" type="image/x-icon">
<link href="https://dl.infragistics.com/x/css/samples/shared.v6.css" rel="stylesheet" />
<link href="https://dl.infragistics.com/x/css/samples/blazor.css" rel="stylesheet" />
<link href="_content/IgniteUI.Blazor/themes/grid/light/bootstrap.css" rel="stylesheet" />
<link href="index.css" rel="stylesheet" />
</head>

<body>
<app class="app"><img class="app-loading" src="https://dl.infragistics.com/x/img/browsers/loading.gif" /></app>
<div class="app-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="app-error-dismiss">🗙</a>
</div>
<!-- importing blazor bundle for IG controls: -->
<script src="_content/IgniteUI.Blazor/app.bundle.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
<!-- importing java scripts used in razor page -->
<script src="events.js"></script>
</body>

</html>