React 계층형 그리드 다중 열 헤더 개요
React Hierarchical Grid의 Ignite UI for React 하면 공통된 다중 헤더 아래에 열을 배치하여 열을 그룹화할 수 있습니다. IgrHierarchicalGrid
의 각 다중 열 헤더 그룹은 다른 그룹이나 열 간의 조합을 나타낼 수 있습니다. 이 기능은 가로로 스크롤하는 것이 번거로울 수 있는 대규모 데이터 세트를 처리할 때 특히 유용합니다.
React 계층형 그리드 다중 열 헤더 예제
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrHierarchicalGridModule, IgrColumnGroupModule } from "@infragistics/igniteui-react-grids";
import { IgrPropertyEditorPanelModule } from "@infragistics/igniteui-react-layouts";
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from "@infragistics/igniteui-react-layouts";
import { IgrHierarchicalGrid, IgrColumn, IgrColumnGroup, IgrRowIsland } from "@infragistics/igniteui-react-grids";
import { ComponentRenderer, WebHierarchicalGridDescriptionModule, WebColumnGroupDescriptionModule, PropertyEditorPanelDescriptionModule } from "@infragistics/igniteui-react-core";
import HierarchicalCustomers from './HierarchicalCustomers.json';
import { IgrPropertyEditorPropertyDescriptionButtonClickEventArgs } from "@infragistics/igniteui-react-layouts";
import "@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css";
import 'igniteui-webcomponents/themes/light/bootstrap.css';
const mods: any[] = [
IgrHierarchicalGridModule,
IgrColumnGroupModule,
IgrPropertyEditorPanelModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private propertyEditor: IgrPropertyEditorPanel
private propertyEditorRef(r: IgrPropertyEditorPanel) {
this.propertyEditor = r;
this.setState({});
}
private propertyEditorPropertyDescription1: IgrPropertyEditorPropertyDescription
private propertyEditorPropertyDescription2: IgrPropertyEditorPropertyDescription
private hierarchicalGrid: IgrHierarchicalGrid
private hierarchicalGridRef(r: IgrHierarchicalGrid) {
this.hierarchicalGrid = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.propertyEditorRef = this.propertyEditorRef.bind(this);
this.webHierarchicalGridPinFirstGroupToggle = this.webHierarchicalGridPinFirstGroupToggle.bind(this);
this.webHierarchicalGridHideFirstGroupToggle = this.webHierarchicalGridHideFirstGroupToggle.bind(this);
this.hierarchicalGridRef = this.hierarchicalGridRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample ig-typography">
<div className="options vertical">
<IgrPropertyEditorPanel
ref={this.propertyEditorRef}
componentRenderer={this.renderer}
target={this.hierarchicalGrid}
descriptionType="WebGrid"
isHorizontal="true"
isWrappingEnabled="true">
<IgrPropertyEditorPropertyDescription
valueType="Button"
primitiveValue="Pin First Group"
buttonClicked={this.webHierarchicalGridPinFirstGroupToggle}
name="propertyEditorPropertyDescription1">
</IgrPropertyEditorPropertyDescription>
<IgrPropertyEditorPropertyDescription
valueType="Button"
primitiveValue="Hide First Group"
buttonClicked={this.webHierarchicalGridHideFirstGroupToggle}
name="propertyEditorPropertyDescription2">
</IgrPropertyEditorPropertyDescription>
</IgrPropertyEditorPanel>
</div>
<div className="container fill">
<IgrHierarchicalGrid
autoGenerate={false}
data={this.hierarchicalCustomers}
ref={this.hierarchicalGridRef}
id="hierarchicalGrid"
primaryKey="CustomerID"
moving={true}
allowFiltering={true}>
<IgrColumn
field="CustomerID"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumnGroup
header="General Information">
<IgrColumn
field="Company"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumnGroup
header="Personal Details">
<IgrColumn
field="ContactName"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ContactTitle"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrColumnGroup
header="Address Information">
<IgrColumnGroup
header="Location">
<IgrColumn
field="Address"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="City"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="PostalCode"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Country"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="Contact Information">
<IgrColumn
field="Phone"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Fax"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrRowIsland
childDataKey="Orders"
autoGenerate={false}>
<IgrColumnGroup
header="Order Information">
<IgrColumnGroup
header="Order Details">
<IgrColumn
field="OrderID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="EmployeeID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="OrderDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="RequiredDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="General Shipping Information">
<IgrColumn
field="ShipDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipVia"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Freight"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipName"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="Shipping Locations">
<IgrColumn
field="ShipAddress"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipCity"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipPostalCode"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipCountry"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrRowIsland
childDataKey="OrderDetails"
autoGenerate={false}>
<IgrColumn
field="ProductID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="UnitPrice"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Quantity"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Discount"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrRowIsland>
</IgrRowIsland>
</IgrHierarchicalGrid>
</div>
</div>
);
}
private _hierarchicalCustomers: any[] = HierarchicalCustomers;
public get hierarchicalCustomers(): any[] {
return this._hierarchicalCustomers;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebHierarchicalGridDescriptionModule.register(context);
WebColumnGroupDescriptionModule.register(context);
PropertyEditorPanelDescriptionModule.register(context);
}
return this._componentRenderer;
}
public webHierarchicalGridPinFirstGroupToggle(sender: any, args: IgrPropertyEditorPropertyDescriptionButtonClickEventArgs): void {
const hgrid: IgrHierarchicalGrid = this.hierarchicalGrid;
const firstColumnGroup = hgrid.getColumnByName("Company").parent;
firstColumnGroup.pinned = !firstColumnGroup.pinned;
hgrid.markForCheck();
}
public webHierarchicalGridHideFirstGroupToggle(sender: any, args: IgrPropertyEditorPropertyDescriptionButtonClickEventArgs): void {
const hgrid: IgrHierarchicalGrid = this.hierarchicalGrid;
const firstColumnGroup = hgrid.getColumnByName("Company").parent;
firstColumnGroup.hidden = !firstColumnGroup.hidden;
hgrid.markForCheck();
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
다중 열 헤더의 선언은 제목 정보가 전달된 header
구성 요소로 columnGroup
열 집합을 래핑하여 수행됩니다.
<IgrHierarchicalGrid autoGenerate={false} data={hierarchicalCustomers} ref={hierarchicalGridRef} id="hierarchicalGrid" primaryKey="ID" moving={true} allowFiltering={true}>
<IgrColumn sortable={true} resizable={true} field="CustomerID" dataType="string"></IgrColumn>
<IgrColumnGroup header="Address Information">
<IgrColumnGroup header="Location">
<IgrColumn sortable={true} resizable={true} field="Address" dataType="string"></IgrColumn>
<IgrColumn sortable={true} resizable={true} field="City" dataType="string"></IgrColumn>
<IgrColumn sortable={true} resizable={true} field="PostalCode" dataType="string"></IgrColumn>
<IgrColumn sortable={true} resizable={true} field="Country" dataType="string"></IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup header="Contact Information">
<IgrColumn sortable={true} resizable={true} field="Phone" dataType="string"></IgrColumn>
<IgrColumn sortable={true} resizable={true} field="Fax" dataType="string"></IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
</IgrHierarchicalGrid>
tsx
중첩된 헤더 수준을 달성 n-th
하려면 위의 선언을 따라야 합니다. 따라서 중첩 columnGroup
을 통해 원하는 결과를 얻을 수 있습니다.
<IgrHierarchicalGrid autoGenerate={false} data={hierarchicalCustomers} ref={hierarchicalGridRef} id="hierarchicalGrid" primaryKey="ID" moving={true} allowFiltering={true}>
<IgrColumn sortable={true} resizable={true} field="CustomerID" dataType="string"></IgrColumn>
<IgrColumnGroup header="General Information">
<IgrColumn sortable={true} resizable={true} field="CompanyName" dataType="string"></IgrColumn>
<IgrColumnGroup header="Person Details">
<IgrColumn sortable={true} resizable={true} field="ContactName" dataType="string"></IgrColumn>
<IgrColumn sortable={true} resizable={true} field="ContactTitle" dataType="string"></IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
</IgrHierarchicalGrid>
tsx
모든 것은 columnGroup
이동, 고정 및 숨기기를 지원합니다.
일련의 열 및 열 그룹이 있는 경우 고정은 최상위 열 상위 항목에 대해서만 작동합니다. 보다 구체적으로 중첩된 열 그룹 또는 열별로 고정하는 것은 허용되지 않습니다. 열과 열 그룹 간 이동은 계층 구조에서 동일한 수준에 있고 둘 다 동일한 그룹에 있는 경우에만 허용됩니다. 열/열 그룹이 현재 그룹으로 래핑되지 않은 경우(즉, 최상위 열임을 의미) 표시되는 전체 열 간에 이동이 허용됩니다.
<IgrHierarchicalGrid autoGenerate={false} data={hierarchicalCustomers} ref={hierarchicalGridRef} id="hierarchicalGrid" primaryKey="ID" moving={true} allowFiltering={true}>
<IgrColumn sortable={true} resizable={true} movable={true} pinned={true} field="CustomerID" dataType="string"></IgrColumn>
<IgrColumnGroup movable={true} pinned={true} header="General Information">
<IgrColumn sortable={true} resizable={true} field="CompanyName" dataType="string"></IgrColumn>
<IgrColumnGroup header="Person Details">
<IgrColumn sortable={true} resizable={true} field="ContactName" dataType="string"></IgrColumn>
<IgrColumn sortable={true} resizable={true} field="ContactTitle" dataType="string"></IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
</IgrHierarchicalGrid>
tsx
다중 열 헤더 템플릿
<IgrColumnGroup header="Contact Information" headerTemplate={groupHeaderTemplate}></IgrColumnGroup>
tsx
const groupHeaderTemplate = (e: IgrColumnTemplateContext) => {
const column = e.column as IgrColumnGroup;
return (
<div>
<span style={{ float: "left" }}>{column.header.toUpperCase()}</span>
</div>
);
}
tsx
헤더가 다시 템플릿화되고 해당 열 그룹이 이동 가능한 경우 템플릿 요소에서 draggable 속성을 false로 설정해야 적용되는 모든 이벤트를 처리할 수 있습니다!
const columnHeaderTemplate = (e: IgrColumnTemplateContext ) => {
const column = e.column as IgrColumnGroup;
return (
<span onClick={onClick}>
<IgrIcon data-draggable="false"></IgrIcon>
</span>
);
}
tsx
다음 샘플은 헤더 템플릿을 사용하여 축소 가능한 열 그룹을 구현하는 방법을 보여줍니다.
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrHierarchicalGridModule, IgrColumnGroupModule } from "@infragistics/igniteui-react-grids";
import { IgrHierarchicalGrid, IgrColumn, IgrColumnGroup, IgrRowIsland } from "@infragistics/igniteui-react-grids";
import { ComponentRenderer, WebHierarchicalGridDescriptionModule, WebColumnGroupDescriptionModule } from "@infragistics/igniteui-react-core";
import HierarchicalCustomers from './HierarchicalCustomers.json';
import { IgrColumnTemplateContext } from "@infragistics/igniteui-react-grids";
import "@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css";
const mods: any[] = [
IgrHierarchicalGridModule,
IgrColumnGroupModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private hierarchicalGrid: IgrHierarchicalGrid
private hierarchicalGridRef(r: IgrHierarchicalGrid) {
this.hierarchicalGrid = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.hierarchicalGridRef = this.hierarchicalGridRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample ig-typography">
<div className="container fill">
<IgrHierarchicalGrid
autoGenerate={false}
data={this.hierarchicalCustomers}
ref={this.hierarchicalGridRef}
id="hierarchicalGrid"
primaryKey="CustomerID"
moving={true}
allowFiltering={true}>
<IgrColumn
field="CustomerID"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumnGroup
header="General Information"
headerTemplate={this.webHierarchicalGridColumnGroupHeaderTemplate}>
<IgrColumn
field="Company"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumnGroup
header="Personal Details">
<IgrColumn
field="ContactName"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ContactTitle"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrColumnGroup
header="Address Information"
headerTemplate={this.webHierarchicalGridColumnGroupHeaderTemplate}>
<IgrColumnGroup
header="Location">
<IgrColumn
field="Address"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="City"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="PostalCode"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Country"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="Contact Information">
<IgrColumn
field="Phone"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Fax"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrRowIsland
childDataKey="Orders"
autoGenerate={false}>
<IgrColumnGroup
header="Order Information">
<IgrColumnGroup
header="Order Details"
headerTemplate={this.webHierarchicalGridColumnGroupHeaderTemplate}>
<IgrColumn
field="OrderID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="EmployeeID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="OrderDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="RequiredDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="General Shipping Information"
headerTemplate={this.webHierarchicalGridColumnGroupHeaderTemplate}>
<IgrColumn
field="ShipDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipVia"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Freight"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipName"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="Shipping Locations"
headerTemplate={this.webHierarchicalGridColumnGroupHeaderTemplate}>
<IgrColumn
field="ShipAddress"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipCity"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipPostalCode"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipCountry"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrRowIsland
childDataKey="OrderDetails"
autoGenerate={false}>
<IgrColumn
field="ProductID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="UnitPrice"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Quantity"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Discount"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrRowIsland>
</IgrRowIsland>
</IgrHierarchicalGrid>
</div>
</div>
);
}
private _hierarchicalCustomers: any[] = HierarchicalCustomers;
public get hierarchicalCustomers(): any[] {
return this._hierarchicalCustomers;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebHierarchicalGridDescriptionModule.register(context);
WebColumnGroupDescriptionModule.register(context);
}
return this._componentRenderer;
}
public webHierarchicalGridColumnGroupHeaderTemplate = (e: { dataContext: IgrColumnTemplateContext }) => {
const column = e.dataContext.column;
return (
<div style={{ display: 'flex', alignItems: 'center', gap: '5px' }}>
<span draggable="false" onClick={(e: any) => this.toggleColumnGroup(column)}>
{this.columnGroupStates.get(column) ? "🔽" : "🔼"}
</span>
<span>{column.header}</span>
</div>
);
};
public columnGroupStates = new Map<IgrColumn, boolean>();
public toggleColumnGroup(columnGroup: IgrColumn) {
const columns = columnGroup.childColumns;
if (columnGroup.header === 'General Information') {
const column = columns[1] as IgrColumn;
column.hidden = !column.hidden;
} else if (columnGroup.header === 'Address Information') {
for (const column of columns) {
const col = column as IgrColumn;
if (col.header === "Location"){
for (const cl of col.childColumns) {
const c = cl as IgrColumn;
if (c.field !== "Address"){
c.hidden = !c.hidden;
}
}
}
else if (col.header === "Contact Information"){
const c = col.childColumns[1] as IgrColumn;
c.hidden = !c.hidden;
}
}
} else {
for (let i = 1; i < columns.length; i++) {
const c = columns[i] as IgrColumn;
c.hidden = !c.hidden;
}
}
this.columnGroupStates.set(columnGroup, !this.columnGroupStates.get(columnGroup));
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
스타일링
사전 정의된 테마 외에도 사용 가능한 CSS 속성 중 일부를 설정하여 그리드를 추가로 사용자 정의할 수 있습니다. 일부 색상을 변경하려면 먼저 그리드에 대한 클래스를 설정해야 합니다.
<IgrHierarchicalGrid className="grid"></IgrHierarchicalGrid>
tsx
그런 다음 관련 CSS 속성을 이 클래스로 설정합니다.
.grid {
--ig-grid-header-background: #e0f3ff;
--ig-grid-header-text-color: #e41c77;
--ig-grid-header-border-width: 1px;
--ig-grid-header-border-style: solid;
--ig-grid-header-border-color: rgba(0, 0, 0, 0.08);
}
css
데모
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrHierarchicalGridModule, IgrColumnGroupModule } from "@infragistics/igniteui-react-grids";
import { IgrHierarchicalGrid, IgrColumn, IgrColumnGroup, IgrRowIsland } from "@infragistics/igniteui-react-grids";
import { ComponentRenderer, WebHierarchicalGridDescriptionModule, WebColumnGroupDescriptionModule } from "@infragistics/igniteui-react-core";
import HierarchicalCustomers from './HierarchicalCustomers.json';
import "@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css";
const mods: any[] = [
IgrHierarchicalGridModule,
IgrColumnGroupModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private hierarchicalGrid: IgrHierarchicalGrid
private hierarchicalGridRef(r: IgrHierarchicalGrid) {
this.hierarchicalGrid = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.hierarchicalGridRef = this.hierarchicalGridRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample ig-typography">
<div className="container fill">
<IgrHierarchicalGrid
autoGenerate={false}
data={this.hierarchicalCustomers}
ref={this.hierarchicalGridRef}
id="hierarchicalGrid"
primaryKey="CustomerID"
moving={true}
allowFiltering={true}>
<IgrColumn
field="CustomerID"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumnGroup
header="General Information">
<IgrColumn
field="Company"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumnGroup
header="Personal Details">
<IgrColumn
field="ContactName"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ContactTitle"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrColumnGroup
header="Address Information">
<IgrColumnGroup
header="Location">
<IgrColumn
field="Address"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="City"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="PostalCode"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Country"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="Contact Information">
<IgrColumn
field="Phone"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Fax"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrRowIsland
childDataKey="Orders"
autoGenerate={false}>
<IgrColumnGroup
header="Order Information">
<IgrColumnGroup
header="Order Details">
<IgrColumn
field="OrderID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="EmployeeID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="OrderDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="RequiredDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="General Shipping Information">
<IgrColumn
field="ShipDate"
dataType="date"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipVia"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Freight"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipName"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
<IgrColumnGroup
header="Shipping Locations">
<IgrColumn
field="ShipAddress"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipCity"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipPostalCode"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="ShipCountry"
dataType="string"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrColumnGroup>
</IgrColumnGroup>
<IgrRowIsland
childDataKey="OrderDetails"
autoGenerate={false}>
<IgrColumn
field="ProductID"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="UnitPrice"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Quantity"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
<IgrColumn
field="Discount"
dataType="number"
sortable={true}
resizable={true}>
</IgrColumn>
</IgrRowIsland>
</IgrRowIsland>
</IgrHierarchicalGrid>
</div>
</div>
);
}
private _hierarchicalCustomers: any[] = HierarchicalCustomers;
public get hierarchicalCustomers(): any[] {
return this._hierarchicalCustomers;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
WebHierarchicalGridDescriptionModule.register(context);
WebColumnGroupDescriptionModule.register(context);
}
return this._componentRenderer;
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
#hierarchicalGrid {
--ig-grid-header-background: #e0f3ff;
--ig-grid-header-text-color: #e41c77;
--ig-grid-header-border-width: 1px;
--ig-grid-header-border-style: solid;
--ig-grid-header-border-color: rgba(0, 0, 0, 0.08);
}
css
API 참조
추가 리소스
우리 커뮤니티는 활동적이며 항상 새로운 아이디어를 환영합니다.