React Hierarchical Grid 複数列ヘッダーの概要
React Hierarchical Grid の Ignite UI for React 複数列ヘッダー機能は、共通の複数ヘッダーの下に配置することで列をグループ化できます。IgrHierarchicalGrid
の各複数ヘッダー グループは、その他のグループや列を組み合わせて表示できます。この機能は、水平方向のスクロールが面倒な大規模なデータセットを扱う場合に特に役立ちます。
React Hierarchical Grid 複数列ヘッダーの例
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
このサンプルが気に入りましたか? 完全な Ignite UI for Reactツールキットにアクセスして、すばやく独自のアプリの作成を開始します。無料でダウンロードできます。
複数列ヘッダーの宣言は、一連の列を columnGroup
コンポーネントにラップし、header
タイトル情報を渡すことによって実現されます。
<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
は、移動、ピン固定、および非表示をサポートしています。
列セットと列グループがある場合、ピン固定は列の一番上の親レベルでのみ可能です。具体的には、ネストされた column groups または columns ごとのピン固定は許可されていません。 columns と column groups 間の移動は、それらが階層内の同じレベルにあり、両方が同じ group にある場合にのみ許可されます。 columns/column-groups が現在の group によってラップされていない場合 (一番上のレベル columns の場合)、表示されている列全体の間で移動が許可されます。
<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 リファレンス
その他のリソース
コミュニティに参加して新しいアイデアをご提案ください。