Web Components 그리드 셀 편집
Web Components Grid의 Ignite UI for Web Components Cell Editing은 Web Components Grid 구성 요소 내의 개별 셀의 내용에 대한 뛰어난 데이터 조작 기능을 제공하며 React CRUD 작업을 위한 강력한 API와 함께 제공됩니다. 스프레드시트, 데이터 테이블 및 데이터 그리드와 같은 앱에서 기본적인 기능으로, 사용자가 특정 셀 내에서 데이터를 추가, 편집 또는 업데이트할 수 있습니다. 기본적으로 Ignite UI for Web Components의 Grid는 셀 편집에 사용됩니다. 그리고 기본 셀 편집 템플릿으로 인해 Top of Form의 열 데이터 유형에 따라 다른 편집기가 있습니다.
또한 데이터 업데이트 작업에 대한 사용자 정의 템플릿을 정의하고 변경 사항 커밋 및 삭제에 대한 기본 동작을 재정의할 수 있습니다.
Web Components 그리드 셀 편집 및 템플릿 편집 예제
import 'igniteui-webcomponents-grids/grids/combined';
import { ComponentRenderer, WebGridDescriptionModule, WebPaginatorDescriptionModule } from 'igniteui-webcomponents-core';
import { IgcGridComponent } from 'igniteui-webcomponents-grids/grids';
import NwindData from './NwindData.json';
import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
import "./index.css";
export class Sample {
private grid: IgcGridComponent
private _bind: () => void;
constructor() {
var grid = this.grid = document.getElementById('grid') as IgcGridComponent;
this._bind = () => {
grid.data = this.nwindData;
}
this._bind();
}
private _nwindData: any[] = NwindData;
public get nwindData(): any[] {
return this._nwindData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebGridDescriptionModule.register(context);
WebPaginatorDescriptionModule.register(context);
}
return this._componentRenderer;
}
}
new Sample();
ts<!DOCTYPE html>
<html>
<head>
<title>Sample | Ignite UI | Web Components | infragistics</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" />
<link rel="stylesheet" href="/src/index.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample ig-typography">
<div class="container fill">
<igc-grid
auto-generate="false"
id="grid"
name="grid"
id="grid"
primary-key="ProductID"
allow-filtering="true">
<igc-paginator
per-page="10">
</igc-paginator>
<igc-column
field="ProductName"
header="Product Name"
data-type="string"
sortable="true"
has-summary="true"
editable="true"
resizable="true">
</igc-column>
<igc-column
field="UnitsInStock"
header="Units in Stock"
data-type="number"
sortable="true"
has-summary="true"
editable="true"
resizable="true">
</igc-column>
<igc-column
field="OrderDate"
header="Order Date"
data-type="date"
sortable="true"
has-summary="true"
editable="true"
resizable="true">
</igc-column>
<igc-column
field="Discontinued"
header="Discontinued"
data-type="boolean"
sortable="true"
has-summary="true"
editable="true">
</igc-column>
<igc-column
field="ReorderLevel"
header="Reorder Level"
data-type="number"
sortable="true"
has-summary="true"
editable="true"
filterable="false">
</igc-column>
</igc-grid>
</div>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
#grid {
--ig-size: var(--ig-size-medium);
}
css
이 샘플이 마음에 드시나요? 당사의 완전한 Ignite UI for Web Components 툴킷에 액세스하여 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.
셀 편집
UI를 통한 편집
다음 방법 중 하나로 편집 가능한 셀에 초점이 맞춰지면 특정 셀에 대한 편집 모드로 들어갈 수 있습니다.
- 두 번 클릭하면;
- 한 번 클릭 시 - 이전에 선택한 셀이 편집 모드이고 현재 선택한 셀이 편집 가능한 경우에만 한 번 클릭하면 편집 모드로 들어갑니다. 이전에 선택한 셀이 편집 모드가 아닌 경우 한 번 클릭하면 편집 모드로 들어가지 않고 셀이 선택됩니다.
- 키를 누르면 Enter;
- 키를 누르면 F2;
다음 방법 중 하나로 변경 사항을 커밋하지 않고 편집 모드를 종료할 수 있습니다.
- 키를 누를 때 Escape;
- 정렬, 필터링, 검색 및 숨기기 작업을 수행할 때
다음 방법 중 하나로 편집 모드를 종료하고 변경 사항을 커밋 할 수 있습니다.
- 키를 누르면 Enter;
- 키를 누르면 F2;
- 키를 누를 때 Tab;
- 다른 셀을 한 번 클릭하면 -
IgcGridComponent
에서 다른 셀을 클릭하면 변경 사항이 제출됩니다. - 페이징, 크기 조정, 고정 또는 이동과 같은 작업을 수행하면 편집 모드가 종료되고 변경 사항이 제출됩니다.
수직 또는 수평으로 스크롤하거나 IgcGridComponent 외부를 클릭하면 셀은 편집 모드로 유지됩니다. 이는 셀 편집과 행 편집 모두에 유효합니다.
API를 통한 편집
IgcGridComponent
API를 통해 셀 값을 수정할 수도 있지만 기본 키가 정의된 경우에만 가능합니다.
public updateCell() {
this.grid1.updateCell(newValue, rowID, 'ReorderLevel');
}
typescript
셀을 업데이트하는 또 다른 방법은 다음과 같은 방법을 사용하는 update
것입니다. Cell
public updateCell() {
const cell = this.grid1.getCellByColumn(rowIndex, 'ReorderLevel');
// You can also get cell by rowID if primary key is defined
// cell = this.grid1.getCellByKey(rowID, 'ReorderLevel');
cell.update(70);
}
typescript
셀 편집 템플릿
일반 편집 항목에서 기본 셀 편집 템플릿에 대해 자세히 알아보고 확인할 수 있습니다.
셀에 적용될 사용자 정의 템플릿을 제공하려는 경우 해당 템플릿을 셀 자체나 헤더에 전달할 수 있습니다. 먼저 평소와 같이 열을 만듭니다.
<igc-column
field="Race"
data-type="string"
editable="true"
id="column1">
</igc-column>
html
index.ts 파일의 이 열에 템플릿을 전달합니다.
constructor() {
var grid1 = document.getElementById('grid1') as IgcGridComponent;
var column1 = document.getElementById('column1') as IgcColumnComponent;
var column2 = document.getElementById('column2') as IgcColumnComponent;
var column3 = document.getElementById('column3') as IgcColumnComponent;
grid1.data = this.webGridCellEditSampleRoleplay;
column1.inlineEditorTemplate = this.webGridCellEditCellTemplate;
column2.inlineEditorTemplate = this.webGridCellEditCellTemplate;
column3.inlineEditorTemplate = this.webGridCellEditCellTemplate;
}
public webGridCellEditCellTemplate = (ctx: IgcCellTemplateContext) => {
let cellValues: any = [];
let uniqueValues: any = [];
for(const i of (this.webGridCellEditSampleRoleplay as any)){
const field: string = ctx.cell.column.field;
if(uniqueValues.indexOf(i[field]) === -1 )
{
cellValues.push(html`<igc-select-item value=${i[field]}>${(i[field])}</igc-select-item>`);
uniqueValues.push(i[field]);
}
}
return html`
<igc-select style="width:100%; height:100%" size="large" @igcChange=${(e: any) => ctx.cell.editValue = e.detail.value}>
${cellValues}
</igc-select>
`;
}
typescript
추가 참조를 위해 위의 작업 샘플을 여기에서 찾을 수 있습니다.
export class RoleplayDataStatsItem {
public constructor(init: Partial<RoleplayDataStatsItem>) {
Object.assign(this, init);
}
public Name: string;
public Age: string;
public Alignment: string;
public Race: string;
public Class: string;
}
export class RoleplayDataStats extends Array<RoleplayDataStatsItem> {
public constructor(items: Array<RoleplayDataStatsItem> | number = -1) {
if (Array.isArray(items)) {
super(...items);
} else {
const newItems = [
new RoleplayDataStatsItem(
{
Name: `Stredo`,
Age: `244`,
Alignment: `💜 Lawful evil`,
Race: `👩 Human`,
Class: `🎻 Bard`
}),
new RoleplayDataStatsItem(
{
Name: `Haluun`,
Age: `40`,
Alignment: `🤍 Unaligned`,
Race: `🧒🏻 Hafling`,
Class: `🙏🏻 Monk`
}),
new RoleplayDataStatsItem(
{
Name: `Ivellios`,
Age: `244`,
Alignment: `🧡 Chaotic good`,
Race: `👩 Human`,
Class: `⚔️ Paladin`
}),
new RoleplayDataStatsItem(
{
Name: `Tes`,
Age: `35`,
Alignment: `💜 Lawful evil`,
Race: `🎭 Changeling`,
Class: `🧙♂️ Wizard`
}),
new RoleplayDataStatsItem(
{
Name: `Kalla`,
Age: `47`,
Alignment: `🤎 Neutral evil`,
Race: `🤖 Warforged`,
Class: `🦹♂️ Sorcerer`
}),
new RoleplayDataStatsItem(
{
Name: `Halimath Dundragon`,
Age: `149`,
Alignment: `🤍 Unaligned`,
Race: `🐲 Dragonborn`,
Class: `⚔️ Paladin`
}),
new RoleplayDataStatsItem(
{
Name: `Iriphawa`,
Age: `39`,
Alignment: `💛 Lawful neutral`,
Race: `🧝🏻♂️ Half-Elf`,
Class: `🏹 Ranger`
}),
new RoleplayDataStatsItem(
{
Name: `Quaf`,
Age: `25`,
Alignment: `💚 Neutral`,
Race: `👩 Human`,
Class: `🥊 Fighter`
}),
new RoleplayDataStatsItem(
{
Name: `Rat Scratch`,
Age: `15`,
Alignment: `🤎 Neutral evil`,
Race: `🐡 Locathah`,
Class: `🍁 Druid`
}),
new RoleplayDataStatsItem(
{
Name: `Slicer`,
Age: `57`,
Alignment: `💜 Lawful evil`,
Race: `🐡 Locathah`,
Class: `💪 Barbarian`
}),
new RoleplayDataStatsItem(
{
Name: `Nereones Ahlorsath`,
Age: `95`,
Alignment: `💛 Lawful neutral`,
Race: `👩 Human`,
Class: `🥊 Fighter`
}),
new RoleplayDataStatsItem(
{
Name: `Nalvarti Stonecutter`,
Age: `118`,
Alignment: `❤️ Neutral good`,
Race: `🧝♀️ Elf`,
Class: `❤️ Cleric`
}),
new RoleplayDataStatsItem(
{
Name: `Errk`,
Age: `22`,
Alignment: `🤎 Neutral evil`,
Race: `🧝🏻♂️ Half-Elf`,
Class: `🎻 Bard`
}),
new RoleplayDataStatsItem(
{
Name: `Seven Thundercloud`,
Age: `43`,
Alignment: `💖 Lawful good`,
Race: `🐡 Locathah`,
Class: `⚔️ Paladin`
}),
new RoleplayDataStatsItem(
{
Name: `Navarra Chergoba`,
Age: `16`,
Alignment: `💜 Lawful evil`,
Race: `🐯 Tabaxi`,
Class: `❤️ Cleric`
}),
new RoleplayDataStatsItem(
{
Name: `Sail Snap`,
Age: `56`,
Alignment: `💖 Lawful good`,
Race: `🌳 Arboren`,
Class: `💪 Barbarian`
}),
new RoleplayDataStatsItem(
{
Name: `Urreek`,
Age: `17`,
Alignment: `💜 Lawful evil`,
Race: `🧝🏻♂️ Half-Elf`,
Class: `🐉 Warlock`
}),
new RoleplayDataStatsItem(
{
Name: `Morkral Firetamer`,
Age: `24`,
Alignment: `🤎 Neutral evil`,
Race: `🐲 Dragonborn`,
Class: `🙏🏻 Monk`
}),
new RoleplayDataStatsItem(
{
Name: `Vithka`,
Age: `53`,
Alignment: `💜 Lawful evil`,
Race: `🐡 Locathah`,
Class: `⚔️ Paladin`
}),
new RoleplayDataStatsItem(
{
Name: `Sandrue Avhoste`,
Age: `19`,
Alignment: `💙 Chaotic Neutral`,
Race: `🐲 Dragonborn`,
Class: `🗡️ Rogue`
}),
new RoleplayDataStatsItem(
{
Name: `Hapah Moq`,
Age: `34`,
Alignment: `💜 Lawful evil`,
Race: `🎅🏽 Dwarf`,
Class: `🎻 Bard`
}),
new RoleplayDataStatsItem(
{
Name: `Kothar `,
Age: `55`,
Alignment: `🤍 Unaligned`,
Race: `🧝🏻♂️ Half-Elf`,
Class: `🐉 Warlock`
}),
new RoleplayDataStatsItem(
{
Name: `Senen`,
Age: `40`,
Alignment: `💜 Lawful evil`,
Race: `🧒🏻 Hafling`,
Class: `🥊 Fighter`
}),
];
super(...newItems.slice(0));
}
}
}
tsimport 'igniteui-webcomponents-grids/grids/combined';
import { ComponentRenderer, WebGridDescriptionModule, WebSelectDescriptionModule } from 'igniteui-webcomponents-core';
import { IgcGridComponent, IgcColumnComponent } from 'igniteui-webcomponents-grids/grids';
import { RoleplayDataStatsItem, RoleplayDataStats } from './RoleplayDataStats';
import { IgcCellTemplateContext } from 'igniteui-webcomponents-grids/grids';
import { html, nothing } from 'lit-html';
import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
import 'igniteui-webcomponents/themes/light/bootstrap.css';
import { defineAllComponents } from 'igniteui-webcomponents';
defineAllComponents();
import "./index.css";
export class Sample {
private grid1: IgcGridComponent
private column1: IgcColumnComponent
private column2: IgcColumnComponent
private column3: IgcColumnComponent
private _bind: () => void;
constructor() {
var grid1 = this.grid1 = document.getElementById('grid1') as IgcGridComponent;
var column1 = this.column1 = document.getElementById('column1') as IgcColumnComponent;
var column2 = this.column2 = document.getElementById('column2') as IgcColumnComponent;
var column3 = this.column3 = document.getElementById('column3') as IgcColumnComponent;
this._bind = () => {
grid1.data = this.roleplayDataStats;
column1.inlineEditorTemplate = this.webGridCellEditCellTemplate;
column2.inlineEditorTemplate = this.webGridCellEditCellTemplate;
column3.inlineEditorTemplate = this.webGridCellEditCellTemplate;
}
this._bind();
}
private _roleplayDataStats: RoleplayDataStats = null;
public get roleplayDataStats(): RoleplayDataStats {
if (this._roleplayDataStats == null)
{
this._roleplayDataStats = new RoleplayDataStats();
}
return this._roleplayDataStats;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebGridDescriptionModule.register(context);
WebSelectDescriptionModule.register(context);
}
return this._componentRenderer;
}
public webGridCellEditCellTemplate = (ctx: IgcCellTemplateContext) => {
let cellValues: any = [];
let uniqueValues: any = [];
let roleplayDataStats = this.grid1.data;
for(const i of (roleplayDataStats as any)){
const field: string = ctx.cell.column.field;
if(uniqueValues.indexOf(i[field]) === -1 )
{
if (ctx.cell.value == i[field]) {
cellValues.push(html`<igc-select-item selected value=${i[field]}>${(i[field])}</igc-select-item>`);
} else cellValues.push(html`<igc-select-item value=${i[field]}>${(i[field])}</igc-select-item>`);
uniqueValues.push(i[field]);
}
}
return html`
<igc-select style="width:100%; height:100%; --ig-size: var(--ig-size-large);" @igcChange=${(e: any) => ctx.cell.editValue = e.detail.value}>
${cellValues}
</igc-select>
`;
}
}
new Sample();
ts<!DOCTYPE html>
<html>
<head>
<title>Sample | Ignite UI | Web Components | infragistics</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" />
<link rel="stylesheet" href="/src/index.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample ig-typography">
<div class="container fill">
<igc-grid
auto-generate="false"
name="grid1"
id="grid1"
primary-key="Name">
<igc-column
field="Name"
header="Character Name"
data-type="string">
</igc-column>
<igc-column
field="Race"
header="Race"
data-type="string"
editable="true"
name="column1"
id="column1">
</igc-column>
<igc-column
field="Class"
header="Class"
editable="true"
data-type="string"
name="column2"
id="column2">
</igc-column>
<igc-column
field="Age"
header="Age"
data-type="string"
editable="true">
</igc-column>
<igc-column
field="Alignment"
header="Alignment"
editable="true"
data-type="string"
name="column3"
id="column3">
</igc-column>
</igc-grid>
</div>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
그리드 엑셀 스타일 편집
Excel 스타일 편집을 사용하면 사용자는 Excel을 사용하는 것처럼 셀을 탐색하고 신속하게 편집할 수 있습니다.
이 사용자 정의 기능을 구현하려면 IgcGridComponent
의 이벤트를 활용하면 됩니다. 먼저 그리드의 keydown 이벤트에 연결하고 거기에서 두 가지 기능을 구현할 수 있습니다.
- 상수 편집 모드
public keydownHandler(event) {
const key = event.keyCode;
const grid = this.grid;
const activeElem = grid.navigation.activeNode;
if ((key >= 48 && key <= 57) ||
(key >= 65 && key <= 90) ||
(key >= 97 && key <= 122)) {
// Number or Alphabet upper case or Alphabet lower case
const columnName = grid.getColumnByVisibleIndex(activeElem.column).field;
const cell = grid.getCellByColumn(activeElem.row, columnName);
if (cell && !grid.crudService.cellInEditMode) {
grid.crudService.enterEditMode(cell);
cell.editValue = event.key;
}
}
}
typescript
- Enter / Shift+Enter 탐색
if (key == 13) {
let thisRow = activeElem.row;
const column = activeElem.column;
const rowInfo = grid.dataView;
// to find the next eligible cell, we will use a custom method that will check the next suitable index
let nextRow = this.getNextEditableRowIndex(thisRow, rowInfo, event.shiftKey);
// and then we will navigate to it using the grid's built in method navigateTo
this.grid.navigateTo(nextRow, column, (obj) => {
obj.target.activate();
this.grid.clearCellSelection();
this.cdr.detectChanges();
});
}
typescript
다음 적격 지수를 찾는 주요 부분은 다음과 같습니다.
//first we check if the currently selected cell is the first or the last
if (currentRowIndex < 0 || (currentRowIndex === 0 && previous) || (currentRowIndex >= dataView.length - 1 && !previous)) {
return currentRowIndex;
}
// in case using shift + enter combination, we look for the first suitable cell going up the field
if (previous) {
return dataView.findLastIndex((rec, index) => index < currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView));
}
// or for the next one down the field
return dataView.findIndex((rec, index) => index > currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView));
typescript
자세한 내용은 전체 샘플을 확인하세요.
Web Components 그리드 Excel 스타일 편집 샘플
export class NwindDataItem {
public constructor(init: Partial<NwindDataItem>) {
Object.assign(this, init);
}
public ProductID: number;
public ProductName: string;
public SupplierID: number;
public CategoryID: number;
public QuantityPerUnit: string;
public UnitPrice: number;
public UnitsInStock: number;
public UnitsOnOrder: number;
public ReorderLevel: number;
public Discontinued: boolean;
public OrderDate: string;
public Rating: number;
public Locations: NwindDataItem_LocationsItem[];
}
export class NwindDataItem_LocationsItem {
public constructor(init: Partial<NwindDataItem_LocationsItem>) {
Object.assign(this, init);
}
public Shop: string;
public LastInventory: string;
}
export class NwindData extends Array<NwindDataItem> {
public constructor(items: Array<NwindDataItem> | number = -1) {
if (Array.isArray(items)) {
super(...items);
} else {
const newItems = [
new NwindDataItem(
{
ProductID: 1,
ProductName: `Chai`,
SupplierID: 1,
CategoryID: 1,
QuantityPerUnit: `10 boxes x 20 bags`,
UnitPrice: 18,
UnitsInStock: 39,
UnitsOnOrder: 30,
ReorderLevel: 10,
Discontinued: false,
OrderDate: `2012-02-12`,
Rating: 5,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Fun-Tasty Co.`,
LastInventory: `2018-06-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
})]
}),
new NwindDataItem(
{
ProductID: 2,
ProductName: `Chang`,
SupplierID: 1,
CategoryID: 1,
QuantityPerUnit: `24 - 12 oz bottles`,
UnitPrice: 19,
UnitsInStock: 17,
UnitsOnOrder: 40,
ReorderLevel: 25,
Discontinued: true,
OrderDate: `2003-03-17`,
Rating: 5,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Super Market`,
LastInventory: `2018-09-09`
})]
}),
new NwindDataItem(
{
ProductID: 3,
ProductName: `Aniseed Syrup`,
SupplierID: 1,
CategoryID: 2,
QuantityPerUnit: `12 - 550 ml bottles`,
UnitPrice: 10,
UnitsInStock: 13,
UnitsOnOrder: 70,
ReorderLevel: 25,
Discontinued: false,
OrderDate: `2006-03-17`,
Rating: 3,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Street Market`,
LastInventory: `2018-12-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `24/7 Market`,
LastInventory: `2018-11-11`
})]
}),
new NwindDataItem(
{
ProductID: 4,
ProductName: `Chef Antons Cajun Seasoning`,
SupplierID: 2,
CategoryID: 2,
QuantityPerUnit: `48 - 6 oz jars`,
UnitPrice: 22,
UnitsInStock: 53,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2016-03-17`,
Rating: 3,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Fun-Tasty Co.`,
LastInventory: `2018-06-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Street Market`,
LastInventory: `2018-12-12`
})]
}),
new NwindDataItem(
{
ProductID: 5,
ProductName: `Chef Antons Gumbo Mix`,
SupplierID: 2,
CategoryID: 2,
QuantityPerUnit: `36 boxes`,
UnitPrice: 21.35,
UnitsInStock: 0,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: true,
OrderDate: `2011-11-11`,
Rating: 5,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Super Market`,
LastInventory: `2018-09-09`
})]
}),
new NwindDataItem(
{
ProductID: 6,
ProductName: `Grandmas Boysenberry Spread`,
SupplierID: 3,
CategoryID: 2,
QuantityPerUnit: `12 - 8 oz jars`,
UnitPrice: 25,
UnitsInStock: 0,
UnitsOnOrder: 30,
ReorderLevel: 25,
Discontinued: false,
OrderDate: `2017-12-17`,
Rating: 4,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Super Market`,
LastInventory: `2018-09-09`
})]
}),
new NwindDataItem(
{
ProductID: 7,
ProductName: `Uncle Bobs Organic Dried Pears`,
SupplierID: 3,
CategoryID: 7,
QuantityPerUnit: `12 - 1 lb pkgs.`,
UnitPrice: 30,
UnitsInStock: 150,
UnitsOnOrder: 30,
ReorderLevel: 10,
Discontinued: false,
OrderDate: `2016-07-17`,
Rating: 5,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Fun-Tasty Co.`,
LastInventory: `2018-06-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Street Market`,
LastInventory: `2018-12-12`
})]
}),
new NwindDataItem(
{
ProductID: 8,
ProductName: `Northwoods Cranberry Sauce`,
SupplierID: 3,
CategoryID: 2,
QuantityPerUnit: `12 - 12 oz jars`,
UnitPrice: 40,
UnitsInStock: 6,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2018-01-17`,
Rating: 4,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Fun-Tasty Co.`,
LastInventory: `2018-06-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
})]
}),
new NwindDataItem(
{
ProductID: 9,
ProductName: `Mishi Kobe Niku`,
SupplierID: 4,
CategoryID: 6,
QuantityPerUnit: `18 - 500 g pkgs.`,
UnitPrice: 97,
UnitsInStock: 29,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: true,
OrderDate: `2010-02-17`,
Rating: 4,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
})]
}),
new NwindDataItem(
{
ProductID: 10,
ProductName: `Ikura`,
SupplierID: 4,
CategoryID: 8,
QuantityPerUnit: `12 - 200 ml jars`,
UnitPrice: 31,
UnitsInStock: 31,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2008-05-17`,
Rating: 3,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Wall Market`,
LastInventory: `2018-12-06`
})]
}),
new NwindDataItem(
{
ProductID: 11,
ProductName: `Queso Cabrales`,
SupplierID: 5,
CategoryID: 4,
QuantityPerUnit: `1 kg pkg.`,
UnitPrice: 21,
UnitsInStock: 22,
UnitsOnOrder: 30,
ReorderLevel: 30,
Discontinued: false,
OrderDate: `2009-01-17`,
Rating: 5,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Fun-Tasty Co.`,
LastInventory: `2018-06-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
})]
}),
new NwindDataItem(
{
ProductID: 12,
ProductName: `Queso Manchego La Pastora`,
SupplierID: 5,
CategoryID: 4,
QuantityPerUnit: `10 - 500 g pkgs.`,
UnitPrice: 38,
UnitsInStock: 86,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2015-11-17`,
Rating: 3,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
})]
}),
new NwindDataItem(
{
ProductID: 13,
ProductName: `Konbu`,
SupplierID: 6,
CategoryID: 8,
QuantityPerUnit: `2 kg box`,
UnitPrice: 6,
UnitsInStock: 24,
UnitsOnOrder: 30,
ReorderLevel: 5,
Discontinued: false,
OrderDate: `2015-03-17`,
Rating: 2,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Super Market`,
LastInventory: `2018-09-09`
})]
}),
new NwindDataItem(
{
ProductID: 14,
ProductName: `Tofu`,
SupplierID: 6,
CategoryID: 7,
QuantityPerUnit: `40 - 100 g pkgs.`,
UnitPrice: 23.25,
UnitsInStock: 35,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2017-06-17`,
Rating: 4,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Street Market`,
LastInventory: `2018-12-12`
})]
}),
new NwindDataItem(
{
ProductID: 15,
ProductName: `Genen Shouyu`,
SupplierID: 6,
CategoryID: 2,
QuantityPerUnit: `24 - 250 ml bottles`,
UnitPrice: 15.5,
UnitsInStock: 39,
UnitsOnOrder: 30,
ReorderLevel: 5,
Discontinued: false,
OrderDate: `2014-03-17`,
Rating: 4,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Local Market`,
LastInventory: `2018-07-03`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Wall Market`,
LastInventory: `2018-12-06`
})]
}),
new NwindDataItem(
{
ProductID: 16,
ProductName: `Pavlova`,
SupplierID: 7,
CategoryID: 3,
QuantityPerUnit: `32 - 500 g boxes`,
UnitPrice: 17.45,
UnitsInStock: 29,
UnitsOnOrder: 30,
ReorderLevel: 10,
Discontinued: false,
OrderDate: `2018-03-28`,
Rating: 2,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Street Market`,
LastInventory: `2018-12-12`
}),
new NwindDataItem_LocationsItem(
{
Shop: `24/7 Market`,
LastInventory: `2018-11-11`
})]
}),
new NwindDataItem(
{
ProductID: 17,
ProductName: `Alice Mutton`,
SupplierID: 7,
CategoryID: 6,
QuantityPerUnit: `20 - 1 kg tins`,
UnitPrice: 39,
UnitsInStock: 0,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: true,
OrderDate: `2015-08-17`,
Rating: 2,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Farmer Market`,
LastInventory: `2018-04-04`
})]
}),
new NwindDataItem(
{
ProductID: 18,
ProductName: `Carnarvon Tigers`,
SupplierID: 7,
CategoryID: 8,
QuantityPerUnit: `16 kg pkg.`,
UnitPrice: 62.5,
UnitsInStock: 42,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2005-09-27`,
Rating: 2,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `24/7 Market`,
LastInventory: `2018-11-11`
}),
new NwindDataItem_LocationsItem(
{
Shop: `Super Market`,
LastInventory: `2018-09-09`
})]
}),
new NwindDataItem(
{
ProductID: 19,
ProductName: `Teatime Chocolate Biscuits`,
SupplierID: 8,
CategoryID: 3,
QuantityPerUnit: ``,
UnitPrice: 9.2,
UnitsInStock: 25,
UnitsOnOrder: 30,
ReorderLevel: 5,
Discontinued: false,
OrderDate: `2001-03-17`,
Rating: 2,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Local Market`,
LastInventory: `2018-07-03`
})]
}),
new NwindDataItem(
{
ProductID: 20,
ProductName: `Sir Rodneys Marmalade`,
SupplierID: 8,
CategoryID: 3,
QuantityPerUnit: `4 - 100 ml jars`,
UnitPrice: 4.5,
UnitsInStock: 40,
UnitsOnOrder: 30,
ReorderLevel: 0,
Discontinued: false,
OrderDate: `2005-03-17`,
Rating: 5,
Locations: [
new NwindDataItem_LocationsItem(
{
Shop: `Super Market`,
LastInventory: `2018-09-09`
})]
}),
];
super(...newItems.slice(0));
}
}
}
tsimport 'igniteui-webcomponents-grids/grids/combined';
import { ComponentRenderer, WebGridDescriptionModule } from 'igniteui-webcomponents-core';
import { IgcCellType, IgcGridComponent } from 'igniteui-webcomponents-grids/grids';
import { NwindData } from './NwindData';
import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
import "./index.css";
export class Sample {
private grid1: IgcGridComponent
private _bind: () => void;
private shouldAppendValue = false;
constructor() {
var grid1 = this.grid1 = document.getElementById('grid1') as IgcGridComponent;
this._bind = () => {
grid1.data = this.nwindData;
grid1.addEventListener('activeNodeChange', (event: any) => {
grid1.endEdit();
(grid1.getElementsByClassName("igx-grid__tbody-content")[0] as any).focus();
});
grid1.addEventListener('keydown', (event: KeyboardEvent) => {
var code = event.code;
var activeElem = grid1.selectedCells[0];
if ((event.code >= 'Digit0' && event.code <= 'Digit9') ||
(event.code >= 'KeyA' && event.code <= 'KeyZ') ||
(event.code >= 'Numpad0' && event.code <= 'Numpad9') &&
event.code !== 'Enter' && event.code !== 'NumpadEnter') {
if (activeElem && activeElem.editMode === false) {
activeElem.editMode = true;
activeElem.editValue = event.key;
this.shouldAppendValue = true;
grid1.markForCheck();
} else
if (activeElem && activeElem.editMode && this.shouldAppendValue) {
event.preventDefault();
activeElem.editValue = activeElem.editValue + event.key;
this.shouldAppendValue = false;
}
}
if (code === 'Backspace') {
if(activeElem == null) {
return;
}
const rowIndex = activeElem.row.index;
const columnKey = activeElem.column.field;
grid1.data[rowIndex][columnKey] = '';
grid1.markForCheck();
}
if (code === 'Enter') {
if(activeElem == null) {
return;
}
const thisRow = activeElem.row.index;
const dataView = this.grid1.dataView;
const nextRowIndex = this.getNextEditableRowIndex(thisRow, dataView, event.shiftKey);
grid1.navigateTo(nextRowIndex, activeElem.column.visibleIndex, (obj: any) => {
grid1.clearCellSelection();
obj.target.activate();
});
}
});
}
this._bind();
}
private _nwindData: NwindData = null;
public get nwindData(): NwindData {
if (this._nwindData == null)
{
this._nwindData = new NwindData();
}
return this._nwindData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebGridDescriptionModule.register(context);
}
return this._componentRenderer;
}
public getNextEditableRowIndex(currentRowIndex: number, dataView: any[], previous: boolean): number {
if (currentRowIndex < 0 || (currentRowIndex === 0 && previous) || (currentRowIndex >= dataView.length - 1 && !previous)) {
return currentRowIndex;
}
if(previous){
for (let index = dataView.length - 1; index >= 0; index--) {
if (index < currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView)) {
return index;
}
}
return -1
}
return dataView.findIndex((rec, index) => index > currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView));
}
private isEditableDataRecordAtIndex(rowIndex: number, dataView: any[]): boolean {
const rec = dataView[rowIndex];
return !rec.expression && !rec.summaries && !rec.childGridsData && !rec.detailsData
}
}
new Sample();
ts<!DOCTYPE html>
<html>
<head>
<title>Sample | Ignite UI | Web Components | infragistics</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" />
<link rel="stylesheet" href="/src/index.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample ig-typography">
<div class="container fill">
<igc-grid
auto-generate="false"
primary-key="ProductID"
cell-selection="single"
name="grid1"
id="grid1">
<igc-column
field="ProductID"
header="Product ID"
editable="true"
groupable="true"
hidden="true">
</igc-column>
<igc-column
field="ProductName"
header="Product Name"
data-type="string"
editable="true">
</igc-column>
<igc-column
field="UnitPrice"
header="Unit Price"
data-type="number"
editable="true">
</igc-column>
<igc-column
field="QuantityPerUnit"
header="Quantity Per Unit"
groupable="true"
data-type="string"
editable="true">
</igc-column>
<igc-column
field="ReorderLevel"
header="Reorder Level"
data-type="number"
groupable="true"
editable="true">
</igc-column>
</igc-grid>
</div>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
위 접근 방식의 주요 이점은 다음과 같습니다.
- 지속적인 편집 모드: 셀이 선택된 동안 입력하면 입력된 값으로 즉시 편집 모드로 들어가 기존 값을 대체합니다.
- Enter / Shift+Enter 를 사용하여 탐색할 때 데이터가 아닌 행은 건너뜁니다. 이를 통해 사용자는 해당 값을 빠르게 순환할 수 있습니다.
CRUD 작업
일부 CRUD 작업을 수행하면 필터링, 정렬, 그룹화 등 적용된 모든 파이프가 다시 적용되고 뷰가 자동으로 업데이트된다는 점을 명심하세요.
IgcGridComponent
는 기본 CRUD 작업을 위한 간단한 API를 제공합니다.
새 레코드 추가
IgcGridComponent
구성 요소는 제공된 데이터를 데이터 소스 자체에 추가하는 addRow
메서드를 노출합니다.
// Adding a new record
// Assuming we have a `getNewRecord` method returning the new row data.
const record = this.getNewRecord();
this.grid.addRow(record);
typescript
그리드에서 데이터 업데이트
그리드의 데이터 업데이트는 updateRow
및 updateCell
메소드를 통해 이루어지지만 그리드의 PrimaryKey가 정의된 경우에만 가능합니다. 또한 해당 업데이트 방법을 통해 셀 및/또는 행 값을 직접 업데이트할 수도 있습니다.
// Updating the whole row
this.grid.updateRow(newData, this.selectedCell.cellID.rowID);
// Just a particular cell through the Grid API
this.grid.updateCell(newData, this.selectedCell.cellID.rowID, this.selectedCell.column.field);
// Directly using the cell `update` method
this.selectedCell.update(newData);
// Directly using the row `update` method
const row = this.grid.getRowByKey(rowID);
row.update(newData);
typescript
그리드에서 데이터 삭제
deleteRow
메소드는 primaryKey
가 정의된 경우에만 지정된 행을 제거한다는 점을 명심하십시오.
// Delete row through Grid API
this.grid.deleteRow(this.selectedCell.cellID.rowID);
// Delete row through row object
const row = this.grid.getRowByIndex(rowIndex);
row.delete();
typescript
편집 이벤트에 대한 셀 유효성 검사
IgcGridComponent
의 편집 이벤트를 사용하면 사용자가 IgcGridComponent
와 상호 작용하는 방식을 변경할 수 있습니다.
이 예에서는 CellEdit
이벤트에 바인딩하여 입력된 데이터를 기반으로 셀의 유효성을 검사합니다. 셀의 새 값이 사전 정의된 기준을 충족하지 않는 경우 이벤트를 취소하여 데이터 소스에 도달하지 못하게 합니다.
가장 먼저 해야 할 일은 그리드의 이벤트에 바인딩하는 것입니다.
constructor() {
var grid = document.getElementById('grid') as IgcGridComponent;
this.webGridCellEdit = this.webGridCellEdit.bind(this);
grid.addEventListener("cellEdit", this.webGridCellEdit);
}
typescript
CellEdit
셀의 값이 커밋되려고 할 때마다 내보냅니다. CellEdit 정의에서 조치를 취하기 전에 특정 열을 확인해야 합니다.
public webGridCellEdit(event: CustomEvent<IgcGridEditEventArgs>): void {
const column = event.detail.column;
if (column.field === 'UnitsOnOrder') {
const rowData = event.detail.rowData;
if (!rowData) {
return;
}
if (event.detail.newValue > rowData.UnitsInStock) {
event.cancel = true;
alert("You cannot order more than the units in stock!");
}
}
}
typescript
주문 단위 열 아래의 셀에 입력된 값이 사용 가능한 금액(재고 단위 아래의 값)보다 큰 경우 편집이 취소되고 사용자에게 취소 알림이 표시됩니다.
IgcGridComponent
에 적용된 위의 검증 결과는 아래 데모에서 볼 수 있습니다.
import 'igniteui-webcomponents-grids/grids/combined';
import { ComponentRenderer, WebGridDescriptionModule } from 'igniteui-webcomponents-core';
import { IgcGridComponent, IgcColumnComponent } from 'igniteui-webcomponents-grids/grids';
import NwindData from './NwindData.json';
import { IgcGridEditEventArgs } from 'igniteui-webcomponents-grids/grids';
import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
import "./index.css";
export class Sample {
private grid1: IgcGridComponent
private unitsInStock: IgcColumnComponent
private unitsOnOrder: IgcColumnComponent
private _bind: () => void;
constructor() {
var grid1 = this.grid1 = document.getElementById('grid1') as IgcGridComponent;
this.webGridEditingEventsCellEdit = this.webGridEditingEventsCellEdit.bind(this);
var unitsInStock = this.unitsInStock = document.getElementById('UnitsInStock') as IgcColumnComponent;
var unitsOnOrder = this.unitsOnOrder = document.getElementById('UnitsOnOrder') as IgcColumnComponent;
this._bind = () => {
grid1.data = this.nwindData;
grid1.addEventListener("cellEdit", this.webGridEditingEventsCellEdit);
}
this._bind();
}
private _nwindData: any[] = NwindData;
public get nwindData(): any[] {
return this._nwindData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebGridDescriptionModule.register(context);
}
return this._componentRenderer;
}
public webGridEditingEventsCellEdit(args: CustomEvent<IgcGridEditEventArgs>): void {
var d = args.detail;
if (d.column != null && d.column.field == "UnitsOnOrder") {
if (d.newValue > d.rowData.UnitsInStock) {
d.cancel = true;
alert("You cannot order more than the units in stock!")
}
}
}
}
new Sample();
ts<!DOCTYPE html>
<html>
<head>
<title>Sample | Ignite UI | Web Components | infragistics</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" />
<link rel="stylesheet" href="/src/index.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample ig-typography">
<div class="container fill">
<igc-grid
auto-generate="false"
primary-key="ProductID"
name="grid1"
id="grid1">
<igc-column
field="ProductName"
header="Product Name"
data-type="string">
</igc-column>
<igc-column
field="UnitPrice"
header="Unit Price"
data-type="number"
editable="true">
</igc-column>
<igc-column
name="UnitsInStock"
id="UnitsInStock"
field="UnitsInStock"
header="Units In Stock"
data-type="number"
editable="true">
</igc-column>
<igc-column
name="UnitsOnOrder"
id="UnitsOnOrder"
field="UnitsOnOrder"
header="Units on Order"
data-type="number"
editable="true">
</igc-column>
</igc-grid>
</div>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
스타일링
사전 정의된 테마 외에도 사용 가능한 CSS 속성 중 일부를 설정하여 그리드를 추가로 사용자 정의할 수 있습니다. 일부 색상을 변경하려면 먼저 그리드에 대한 클래스를 설정해야 합니다.
<igc-grid class="grid"></igc-grid>
html
그런 다음 해당 클래스에 대한 관련 CSS 속성을 설정합니다.
.grid {
--ig-grid-edit-mode-color: orange;
--ig-grid-cell-editing-background: lightblue;
}
css
스타일링 예시
import 'igniteui-webcomponents-grids/grids/combined';
import { ComponentRenderer, WebGridDescriptionModule, WebPaginatorDescriptionModule } from 'igniteui-webcomponents-core';
import { IgcGridComponent } from 'igniteui-webcomponents-grids/grids';
import NwindData from './NwindData.json';
import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
import "./index.css";
export class Sample {
private grid: IgcGridComponent
private _bind: () => void;
constructor() {
var grid = this.grid = document.getElementById('grid') as IgcGridComponent;
this._bind = () => {
grid.data = this.nwindData;
}
this._bind();
}
private _nwindData: any[] = NwindData;
public get nwindData(): any[] {
return this._nwindData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebGridDescriptionModule.register(context);
WebPaginatorDescriptionModule.register(context);
}
return this._componentRenderer;
}
}
new Sample();
ts<!DOCTYPE html>
<html>
<head>
<title>Sample | Ignite UI | Web Components | infragistics</title>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" />
<link rel="stylesheet" href="/src/index.css" type="text/css" />
</head>
<body>
<div id="root">
<div class="container sample ig-typography">
<div class="container fill">
<igc-grid
auto-generate="false"
id="grid"
name="grid"
id="grid"
primary-key="ProductID"
allow-filtering="true">
<igc-paginator
per-page="10">
</igc-paginator>
<igc-column
field="ProductName"
header="Product Name"
data-type="string"
sortable="true"
has-summary="true"
editable="true"
resizable="true">
</igc-column>
<igc-column
field="UnitsInStock"
header="Units in Stock"
data-type="number"
sortable="true"
has-summary="true"
editable="true"
resizable="true">
</igc-column>
<igc-column
field="OrderDate"
header="Order Date"
data-type="date"
sortable="true"
has-summary="true"
editable="true"
resizable="true">
</igc-column>
<igc-column
field="Discontinued"
header="Discontinued"
data-type="boolean"
sortable="true"
has-summary="true"
editable="true">
</igc-column>
<igc-column
field="ReorderLevel"
header="Reorder Level"
data-type="number"
sortable="true"
has-summary="true"
editable="true"
filterable="false">
</igc-column>
</igc-grid>
</div>
</div>
</div>
<!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><script src="src/index.ts"></script><% } %>
</body>
</html>
html/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
#grid {
--ig-size: var(--ig-size-medium);
}
#grid {
--ig-grid-edit-mode-color: #FFA500;
--ig-grid-cell-active-border-color: #AAFF00;
--ig-grid-cell-editing-background: #ADD8E6;
}
css