React Hierarchical Grid 行のピン固定
React Hierarchical Grid の Ignite UI for React 行ピン固定機能を使用すると、1 つまたは複数の行をグリッドの上部または下部にピン固定できます。行ピン固定を使用すると、エンドユーザーは特定の順序で行をピン固定し、IgrHierarchicalGrid
を垂直にスクロールしても常に表示される特別な領域に行を複製できます。React Hierarchical Grid には組み込みの行ピン固定 UI が含まれており、Hierarchical Grid のコンテキストで IgrActionStrip
コンポーネントを初期化することで有効になります。その他、カスタム UI を定義し、行のピン固定 API を介して行のピン固定状態を変更できます。
React Hierarchical Grid 行ピン固定の例
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrPropertyEditorPanelModule } from "@infragistics/igniteui-react-layouts";
import { IgrHierarchicalGridModule } from "@infragistics/igniteui-react-grids";
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from "@infragistics/igniteui-react-layouts";
import { IgrHierarchicalGrid, IgrPinningConfig, RowPinningPosition, ColumnPinningPosition, IgrColumn, IgrActionStrip, IgrGridPinningActions, IgrRowIsland } from "@infragistics/igniteui-react-grids";
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, WebHierarchicalGridDescriptionModule } from "@infragistics/igniteui-react-core";
import SingersData from './SingersData.json';
import { IgrPropertyEditorPropertyDescriptionChangedEventArgs } from "@infragistics/igniteui-react-layouts";
import "@infragistics/igniteui-react-grids/grids/combined";
import "@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css";
import 'igniteui-webcomponents/themes/light/bootstrap.css';
const mods: any[] = [
IgrPropertyEditorPanelModule,
IgrHierarchicalGridModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private propertyEditorHierarchicalGrid: IgrPropertyEditorPanel
private propertyEditorHierarchicalGridRef(r: IgrPropertyEditorPanel) {
this.propertyEditorHierarchicalGrid = r;
this.setState({});
}
private rowPinningEditor: IgrPropertyEditorPropertyDescription
private grid: IgrHierarchicalGrid
private gridRef(r: IgrHierarchicalGrid) {
this.grid = r;
this.setState({});
}
private _pinningConfig1: IgrPinningConfig | null = null;
public get pinningConfig1(): IgrPinningConfig {
if (this._pinningConfig1 == null)
{
var pinningConfig1: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig1.rows = RowPinningPosition.Top;
pinningConfig1.columns = ColumnPinningPosition.End;
this._pinningConfig1 = pinningConfig1;
}
return this._pinningConfig1;
}
private actionStrip1: IgrActionStrip
private rowIsland1: IgrRowIsland
private _pinningConfig2: IgrPinningConfig | null = null;
public get pinningConfig2(): IgrPinningConfig {
if (this._pinningConfig2 == null)
{
var pinningConfig2: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig2.rows = RowPinningPosition.Top;
pinningConfig2.columns = ColumnPinningPosition.End;
this._pinningConfig2 = pinningConfig2;
}
return this._pinningConfig2;
}
private actionStrip2: IgrActionStrip
constructor(props: any) {
super(props);
this.propertyEditorHierarchicalGridRef = this.propertyEditorHierarchicalGridRef.bind(this);
this.webHierarchicalGridChangePinningConfig = this.webHierarchicalGridChangePinningConfig.bind(this);
this.gridRef = this.gridRef.bind(this);
this.webHierarchicalGridPinRowOnRendered = this.webHierarchicalGridPinRowOnRendered.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample ig-typography">
<div className="options vertical">
<IgrPropertyEditorPanel
ref={this.propertyEditorHierarchicalGridRef}
componentRenderer={this.renderer}
target={this.grid}
descriptionType="WebHierarchicalGrid"
isHorizontal="true"
isWrappingEnabled="true">
<IgrPropertyEditorPropertyDescription
name="rowPinningEditor"
label="Row Pinning toggle"
valueType="EnumValue"
dropDownNames={["Top", "Bottom"]}
dropDownValues={["Top", "Bottom"]}
changed={this.webHierarchicalGridChangePinningConfig}>
</IgrPropertyEditorPropertyDescription>
</IgrPropertyEditorPanel>
</div>
<div className="container fill">
<IgrHierarchicalGrid
autoGenerate={false}
data={this.singersData}
primaryKey="Photo"
id="grid"
ref={this.gridRef}
cellSelection="none"
rendered={this.webHierarchicalGridPinRowOnRendered}
pinning={this.pinningConfig1}>
<IgrColumn
field="Artist"
header="Artist"
dataType="string">
</IgrColumn>
<IgrColumn
field="Photo"
header="Photo"
dataType="image"
minWidth="115px">
</IgrColumn>
<IgrColumn
field="Debut"
header="Debut"
dataType="number">
</IgrColumn>
<IgrColumn
field="GrammyNominations"
header="Grammy Nominations"
dataType="string">
</IgrColumn>
<IgrColumn
field="GrammyAwards"
header="Grammy Awards"
dataType="string">
</IgrColumn>
<IgrActionStrip
name="actionStrip1">
<IgrGridPinningActions
>
</IgrGridPinningActions>
</IgrActionStrip>
<IgrRowIsland
childDataKey="Albums"
primaryKey="Album"
cellSelection="none"
autoGenerate={false}
pinning={this.pinningConfig2}
name="rowIsland1">
<IgrColumn
field="Album"
header="Album"
dataType="string">
</IgrColumn>
<IgrColumn
field="LaunchDate"
header="Launch Date"
dataType="date">
</IgrColumn>
<IgrColumn
field="BillboardReview"
header="Billboard Review"
dataType="string">
</IgrColumn>
<IgrColumn
field="USBillboard200"
header="US Billboard 200"
dataType="string">
</IgrColumn>
<IgrActionStrip
name="actionStrip2">
<IgrGridPinningActions
>
</IgrGridPinningActions>
</IgrActionStrip>
</IgrRowIsland>
</IgrHierarchicalGrid>
</div>
</div>
);
}
private _singersData: any[] = SingersData;
public get singersData(): any[] {
return this._singersData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
WebHierarchicalGridDescriptionModule.register(context);
}
return this._componentRenderer;
}
public webHierarchicalGridChangePinningConfig(sender: any, args: IgrPropertyEditorPropertyDescriptionChangedEventArgs): void {
var newPinningPosition = args.newValue === "Top" ? RowPinningPosition.Top : RowPinningPosition.Bottom;
var grid = this.grid;
grid.pinning.rows = newPinningPosition;
var rowIsland1 = grid.contentChildLayoutList.filter(e => e.childDataKey == 'Albums');
rowIsland1[0].pinning.rows = newPinningPosition;
var rowIsland2 = rowIsland1[0].contentChildLayoutList.filter(e => e.childDataKey == 'Songs');
if(rowIsland2[0]) {
rowIsland2[0].pinning.rows = newPinningPosition;
}
var rowIsland3 = grid.contentChildLayoutList.filter(e => e.childDataKey == 'Tours');
if(rowIsland3[0]) {
rowIsland3[0].pinning.rows = newPinningPosition
}
}
public webHierarchicalGridPinRowOnRendered(): void {
var hierarchicalGrid = this.grid;
hierarchicalGrid.pinRow(hierarchicalGrid.data[0].Photo);
hierarchicalGrid.pinRow(hierarchicalGrid.data[1].Photo);
}
}
// 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ツールキットにアクセスして、すばやく独自のアプリの作成を開始します。無料でダウンロードできます。
行のピン固定 UI
組み込みの行ピン固定 UI は、IgrGridPinningActions
コンポーネントと IgrActionStrip
コンポーネントを追加することで有効になります。アクション ストリップは、行にカーソルを合わせると自動的に表示され、表示されている行の状態に基づいてピン固定またはピン固定解除ボタンのアイコンが表示されます。ピン固定された行のコピーをビューにスクロールする追加のアクションがピン固定された行ごとに表示されます。
<IgrHierarchicalGrid>
<IgrColumn field="Country" header="Country"> </IgrColumn>
<IgrActionStrip key="actionStrip">
<IgrGridPinningActions key="pinningActions"></IgrGridPinningActions>
<IgrGridEditingActions key="editingActions"></IgrGridEditingActions>
</IgrActionStrip>
</IgrHierarchicalGrid>
tsx
行のピン固定 API
行のピン固定は Row
の pinned
入力によって制御されます。デフォルトでピン固定行は IgrHierarchicalGrid
の上側に固定して描画され、IgrHierarchicalGrid
本体のピン固定されていない行は垂直スクロールされます。
gridRef.current.getRowByIndex(0).pinned = true;
tsx
IgrHierarchicalGrid
の pinRow
または unpinRow
メソッドを使用して ID によって行をピン固定またはピン固定解除できます。
gridRef.current.pinRow('ALFKI');
gridRef.current.unpinRow('ALFKI');
tsx
注: 行の ID は、グリッドの primaryKey
またはレコード インスタンス自体によって定義される主キー値です。両方のメソッドは操作に成功したかどうかを示すブール値を返します。よくある失敗の原因に行がすでにその状態になっていることがあります。
行は、最後にピンされた行の下にピン固定されます。ピン固定行の順序を変更するには、RowPinning
イベントでイベント引数の InsertAtIndex
プロパティを適切な位置インデックスに変更します。
function rowPinning(grid: IgrGridBaseDirective, event: IgrPinRowEventArgs ) {
event.detail.insertAtIndex = 0;
}
<IgrHierarchicalGrid autoGenerate="true" rowPinning={rowPinning}>
</IgrHierarchicalGrid>
tsx
ピン固定の位置
pinning
設定オプションを使用して、行のピン固定の位置を変更できます。ピン固定の位置を Top または Bottom のいずれかに設定できます。
Bottom に設定すると、行がピン固定されていない行の後に、グリッドの一番下にレンダリングされます。ピン固定されていない行は垂直にスクロールできますが、ピン固定された行は下側に固定されます。
<IgrHierarchicalGrid id="dataGrid" autoGenerate="true">
</IgrHierarchicalGrid>
var grid = document.getElementById("dataGrid") as IgrHierarchicalGrid;
grid.pinning = { rows: RowPinningPosition.Bottom };
tsx
カスタム行ピン固定 UI
カスタム UI を定義し、関連する API を介して行のピン状態を変更できます。
アイコン付きの追加の列による
アクション ストリップの代わりに、すべての行にピンのアイコンを表示し、エンドユーザーが特定の行のピン状態をクリックして変更できます。 カスタム アイコンを含むセル テンプレートの列を追加することで実行できます。
function cellPinCellTemplate(ctx: IgrCellTemplateContext) {
const row = ctx.dataContext.cell.row;
return (
<>
<span onPointerDown={(e: any) => toggleRowPin(row)}>📌</span>
</>
);
}
<IgrHierarchicalGrid primaryKey="ID" autoGenerate="false">
<IgrColumn width="70px" bodyTemplate={cellPinCellTemplate}>
</IgrColumn>
<IgrRowIsland childDataKey="Orders" autoGenerate="true"></IgrRowIsland>
</IgrHierarchicalGrid>
tsx
カスタムアイコンをクリックすると、関連する行のピン状態は、行の API メソッドを使用して変更できます。
function toggleRowPin(row: IgrRowType) {
row.pinned = !row.pinned;
}
tsx
デモ
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrPropertyEditorPanelModule } from "@infragistics/igniteui-react-layouts";
import { IgrHierarchicalGridModule } from "@infragistics/igniteui-react-grids";
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from "@infragistics/igniteui-react-layouts";
import { IgrHierarchicalGrid, IgrPinningConfig, RowPinningPosition, ColumnPinningPosition, IgrColumn, IgrRowIsland } from "@infragistics/igniteui-react-grids";
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, WebHierarchicalGridDescriptionModule } from "@infragistics/igniteui-react-core";
import SingersData from './SingersData.json';
import { IgrPropertyEditorPropertyDescriptionChangedEventArgs } from "@infragistics/igniteui-react-layouts";
import { IgrCellTemplateContext, IgrRowType } from "@infragistics/igniteui-react-grids";
import "@infragistics/igniteui-react-grids/grids/combined";
import "@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css";
import 'igniteui-webcomponents/themes/light/bootstrap.css';
const mods: any[] = [
IgrPropertyEditorPanelModule,
IgrHierarchicalGridModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private propertyEditorHierarchicalGrid: IgrPropertyEditorPanel
private propertyEditorHierarchicalGridRef(r: IgrPropertyEditorPanel) {
this.propertyEditorHierarchicalGrid = r;
this.setState({});
}
private rowPinningEditor: IgrPropertyEditorPropertyDescription
private grid: IgrHierarchicalGrid
private gridRef(r: IgrHierarchicalGrid) {
this.grid = r;
this.setState({});
}
private _pinningConfig1: IgrPinningConfig | null = null;
public get pinningConfig1(): IgrPinningConfig {
if (this._pinningConfig1 == null)
{
var pinningConfig1: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig1.rows = RowPinningPosition.Top;
pinningConfig1.columns = ColumnPinningPosition.End;
this._pinningConfig1 = pinningConfig1;
}
return this._pinningConfig1;
}
private column1: IgrColumn
private rowIsland1: IgrRowIsland
private _pinningConfig2: IgrPinningConfig | null = null;
public get pinningConfig2(): IgrPinningConfig {
if (this._pinningConfig2 == null)
{
var pinningConfig2: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig2.rows = RowPinningPosition.Top;
pinningConfig2.columns = ColumnPinningPosition.End;
this._pinningConfig2 = pinningConfig2;
}
return this._pinningConfig2;
}
private column2: IgrColumn
private rowIsland2: IgrRowIsland
private _pinningConfig3: IgrPinningConfig | null = null;
public get pinningConfig3(): IgrPinningConfig {
if (this._pinningConfig3 == null)
{
var pinningConfig3: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig3.rows = RowPinningPosition.Top;
pinningConfig3.columns = ColumnPinningPosition.End;
this._pinningConfig3 = pinningConfig3;
}
return this._pinningConfig3;
}
private column3: IgrColumn
private rowIsland3: IgrRowIsland
private _pinningConfig4: IgrPinningConfig | null = null;
public get pinningConfig4(): IgrPinningConfig {
if (this._pinningConfig4 == null)
{
var pinningConfig4: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig4.rows = RowPinningPosition.Top;
pinningConfig4.columns = ColumnPinningPosition.End;
this._pinningConfig4 = pinningConfig4;
}
return this._pinningConfig4;
}
private column4: IgrColumn
constructor(props: any) {
super(props);
this.propertyEditorHierarchicalGridRef = this.propertyEditorHierarchicalGridRef.bind(this);
this.webHierarchicalGridChangePinningConfig = this.webHierarchicalGridChangePinningConfig.bind(this);
this.gridRef = this.gridRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample ig-typography">
<div className="options vertical">
<IgrPropertyEditorPanel
ref={this.propertyEditorHierarchicalGridRef}
componentRenderer={this.renderer}
target={this.grid}
descriptionType="WebHierarchicalGrid"
isHorizontal="true"
isWrappingEnabled="true">
<IgrPropertyEditorPropertyDescription
name="rowPinningEditor"
label="Row Pinning toggle"
valueType="EnumValue"
dropDownNames={["Top", "Bottom"]}
dropDownValues={["Top", "Bottom"]}
changed={this.webHierarchicalGridChangePinningConfig}>
</IgrPropertyEditorPropertyDescription>
</IgrPropertyEditorPanel>
</div>
<div className="container fill">
<IgrHierarchicalGrid
autoGenerate={false}
data={this.singersData}
primaryKey="Photo"
id="grid"
ref={this.gridRef}
cellSelection="none"
pinning={this.pinningConfig1}>
<IgrColumn
width="70px"
filterable={false}
pinned={true}
bodyTemplate={this.webHierarchicalGridRowPinCellTemplate}
name="column1">
</IgrColumn>
<IgrColumn
field="Artist"
header="Artist"
dataType="string">
</IgrColumn>
<IgrColumn
field="Photo"
header="Photo"
dataType="image">
</IgrColumn>
<IgrColumn
field="Debut"
header="Debut"
dataType="number">
</IgrColumn>
<IgrColumn
field="GrammyNominations"
header="Grammy Nominations"
dataType="string">
</IgrColumn>
<IgrColumn
field="GrammyAwards"
header="Grammy Awards"
dataType="string">
</IgrColumn>
<IgrRowIsland
childDataKey="Albums"
primaryKey="Album"
cellSelection="none"
pinning={this.pinningConfig2}
autoGenerate={false}
name="rowIsland1">
<IgrColumn
width="70px"
filterable={false}
pinned={true}
bodyTemplate={this.webHierarchicalGridRowPinCellTemplate}
name="column2">
</IgrColumn>
<IgrColumn
field="Album"
header="Album"
dataType="string">
</IgrColumn>
<IgrColumn
field="LaunchDate"
header="Launch Date"
dataType="date">
</IgrColumn>
<IgrColumn
field="BillboardReview"
header="Billboard Review"
dataType="string">
</IgrColumn>
<IgrColumn
field="USBillboard200"
header="US Billboard 200"
dataType="string">
</IgrColumn>
<IgrRowIsland
childDataKey="Songs"
primaryKey="Number"
cellSelection="none"
pinning={this.pinningConfig3}
autoGenerate={false}
name="rowIsland2">
<IgrColumn
width="70px"
filterable={false}
pinned={true}
bodyTemplate={this.webHierarchicalGridRowPinCellTemplate}
name="column3">
</IgrColumn>
<IgrColumn
field="Number"
header="No."
dataType="string">
</IgrColumn>
<IgrColumn
field="Title"
header="Title"
dataType="string">
</IgrColumn>
<IgrColumn
field="Released"
header="Released"
dataType="string">
</IgrColumn>
<IgrColumn
field="Genre"
header="Genre"
dataType="string">
</IgrColumn>
</IgrRowIsland>
</IgrRowIsland>
<IgrRowIsland
childDataKey="Tours"
primaryKey="Tour"
cellSelection="none"
pinning={this.pinningConfig4}
autoGenerate={false}
name="rowIsland3">
<IgrColumn
width="70px"
filterable={false}
pinned={true}
bodyTemplate={this.webHierarchicalGridRowPinCellTemplate}
name="column4">
</IgrColumn>
<IgrColumn
field="Tour"
header="Tour"
dataType="string">
</IgrColumn>
<IgrColumn
field="StartedOn"
header="Started on"
dataType="string">
</IgrColumn>
<IgrColumn
field="Location"
header="Location"
dataType="string">
</IgrColumn>
<IgrColumn
field="Headliner"
header="Headliner"
dataType="string">
</IgrColumn>
</IgrRowIsland>
</IgrHierarchicalGrid>
</div>
</div>
);
}
private _singersData: any[] = SingersData;
public get singersData(): any[] {
return this._singersData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
WebHierarchicalGridDescriptionModule.register(context);
}
return this._componentRenderer;
}
public webHierarchicalGridChangePinningConfig(sender: any, args: IgrPropertyEditorPropertyDescriptionChangedEventArgs): void {
var newPinningPosition = args.newValue === "Top" ? RowPinningPosition.Top : RowPinningPosition.Bottom;
var grid = this.grid;
grid.pinning.rows = newPinningPosition;
var rowIsland1 = grid.contentChildLayoutList.filter(e => e.childDataKey == 'Albums');
rowIsland1[0].pinning.rows = newPinningPosition;
var rowIsland2 = rowIsland1[0].contentChildLayoutList.filter(e => e.childDataKey == 'Songs');
if(rowIsland2[0]) {
rowIsland2[0].pinning.rows = newPinningPosition;
}
var rowIsland3 = grid.contentChildLayoutList.filter(e => e.childDataKey == 'Tours');
if(rowIsland3[0]) {
rowIsland3[0].pinning.rows = newPinningPosition
}
}
public webHierarchicalGridRowPinCellTemplate = (e: {dataContext: IgrCellTemplateContext}) => {
const row = e.dataContext.cell.row;
return (
<span onPointerDown={(e: any) => this.toggleRowPin(row)} style={{ cursor: 'pointer'}}>📌</span>
);
}
public toggleRowPin(row: IgrRowType) {
row.pinned = !row.pinned;
}
}
// 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
行ピン固定の制限
- データソースに存在するレコードのみをピン固定できます。
- 行のピン固定状態は Excel にエクスポートされません。グリッドは行のピン固定が適用されずにエクスポートされます。
- グリッドのスクロール可能領域におけるピン固定行のコピーは、ピン固定行が存在する状態で他のグリッド機能が動作するのに不可欠な役割を果たします。そのため、その生成を無効化または削除することはできません。
- 行選択 は 行 ID のみで動作するため、ピン固定行を選択するとそのコピーも選択されます (逆も同様)。さらに、ピン固定領域での範囲選択 (Shift + クリックにより) は、スクロール可能な領域で行を範囲選択する場合と同じように機能します。結果として、間にある行はピン固定されていなくてもすべて選択されます。API を 介して選択した行を取得すると、選択した各レコードの単一のインスタンスのみを返します。
スタイル設定
定義済みのテーマに加えて、利用可能な CSS プロパティのいくつかを設定することで、グリッドをさらにカスタマイズできます。 一部の色を変更したい場合は、最初にグリッドのクラスを設定する必要があります。
<IgrHierarchicalGrid className="grid"></IgrHierarchicalGrid>
tsx
次に、そのクラスに関連する CSS プロパティを設定します。
.grid {
--ig-grid-pinned-border-width: 5px;
--ig-grid-pinned-border-style: double;
--ig-grid-pinned-border-color: #FFCD0F;
--ig-grid-cell-active-border-color: #FFCD0F;
}
css
デモ
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrHierarchicalGridModule } from "@infragistics/igniteui-react-grids";
import { IgrHierarchicalGrid, IgrPinningConfig, RowPinningPosition, ColumnPinningPosition, IgrColumn, IgrActionStrip, IgrGridPinningActions, IgrRowIsland } from "@infragistics/igniteui-react-grids";
import SingersData from './SingersData.json';
import { IgrGrid } from "@infragistics/igniteui-react-grids";
import "@infragistics/igniteui-react-grids/grids/combined";
import "@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css";
const mods: any[] = [
IgrHierarchicalGridModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private grid: IgrHierarchicalGrid
private gridRef(r: IgrHierarchicalGrid) {
this.grid = r;
this.setState({});
}
private _pinningConfig1: IgrPinningConfig | null = null;
public get pinningConfig1(): IgrPinningConfig {
if (this._pinningConfig1 == null)
{
var pinningConfig1: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig1.rows = RowPinningPosition.Top;
pinningConfig1.columns = ColumnPinningPosition.End;
this._pinningConfig1 = pinningConfig1;
}
return this._pinningConfig1;
}
private actionStrip1: IgrActionStrip
private rowIsland1: IgrRowIsland
private _pinningConfig2: IgrPinningConfig | null = null;
public get pinningConfig2(): IgrPinningConfig {
if (this._pinningConfig2 == null)
{
var pinningConfig2: IgrPinningConfig = {} as IgrPinningConfig;
pinningConfig2.rows = RowPinningPosition.Top;
pinningConfig2.columns = ColumnPinningPosition.End;
this._pinningConfig2 = pinningConfig2;
}
return this._pinningConfig2;
}
private actionStrip2: IgrActionStrip
constructor(props: any) {
super(props);
this.gridRef = this.gridRef.bind(this);
this.webHierarchicalGridPinRowOnRendered = this.webHierarchicalGridPinRowOnRendered.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample ig-typography">
<div className="container fill">
<IgrHierarchicalGrid
autoGenerate={false}
data={this.singersData}
primaryKey="Photo"
id="grid"
ref={this.gridRef}
cellSelection="none"
rendered={this.webHierarchicalGridPinRowOnRendered}
pinning={this.pinningConfig1}>
<IgrColumn
field="Artist"
header="Artist"
dataType="string">
</IgrColumn>
<IgrColumn
field="Photo"
header="Photo"
dataType="image"
minWidth="115px">
</IgrColumn>
<IgrColumn
field="Debut"
header="Debut"
dataType="number">
</IgrColumn>
<IgrColumn
field="GrammyNominations"
header="Grammy Nominations"
dataType="string">
</IgrColumn>
<IgrColumn
field="GrammyAwards"
header="Grammy Awards"
dataType="string">
</IgrColumn>
<IgrActionStrip
name="actionStrip1">
<IgrGridPinningActions
>
</IgrGridPinningActions>
</IgrActionStrip>
<IgrRowIsland
childDataKey="Albums"
primaryKey="Album"
cellSelection="none"
autoGenerate={false}
pinning={this.pinningConfig2}
name="rowIsland1">
<IgrColumn
field="Album"
header="Album"
dataType="string">
</IgrColumn>
<IgrColumn
field="LaunchDate"
header="Launch Date"
dataType="date">
</IgrColumn>
<IgrColumn
field="BillboardReview"
header="Billboard Review"
dataType="string">
</IgrColumn>
<IgrColumn
field="USBillboard200"
header="US Billboard 200"
dataType="string">
</IgrColumn>
<IgrActionStrip
name="actionStrip2">
<IgrGridPinningActions
>
</IgrGridPinningActions>
</IgrActionStrip>
</IgrRowIsland>
</IgrHierarchicalGrid>
</div>
</div>
);
}
private _singersData: any[] = SingersData;
public get singersData(): any[] {
return this._singersData;
}
public webHierarchicalGridPinRowOnRendered(): void {
var hierarchicalGrid = this.grid;
hierarchicalGrid.pinRow(hierarchicalGrid.data[0].Photo);
hierarchicalGrid.pinRow(hierarchicalGrid.data[1].Photo);
}
}
// 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 */
#grid {
--ig-grid-pinned-border-width: 5px;
--ig-grid-pinned-border-style: double;
--ig-grid-pinned-border-color: #FFCD0F;
--ig-grid-cell-active-border-color: #FFCD0F;
}
css
API リファレンス
IgrHierarchicalGrid
HierarchicalGridRow
IgrRowType
その他のリソース
コミュニティに参加して新しいアイデアをご提案ください。