|  | 
|  | 1 | +--- | 
|  | 2 | +title: {Platform} {ComponentTitle} セル結合 - {ProductName} | 
|  | 3 | +_description: {ProductName} for {Platform} {ComponentTitle} の複数行レイアウト機能を使用して、列をより強力な方法で配置およびサイズ設定します。デモと例をお試しください。 | 
|  | 4 | +_keywords: cell merging, {Platform}, {ComponentKeywords}, {ProductName}, Infragistics, セル結合, インフラジスティックス | 
|  | 5 | +mentionedTypes: [{ComponentApiMembers}] | 
|  | 6 | +sharedComponents: ["Grid", "TreeGrid", "HierarchicalGrid"] | 
|  | 7 | +namespace: Infragistics.Controls | 
|  | 8 | +_canonicalLink: {CanonicalLinkToGridCellMerging} | 
|  | 9 | +_language: ja | 
|  | 10 | +--- | 
|  | 11 | + | 
|  | 12 | +# {Platform} {ComponentTitle} セル結合 | 
|  | 13 | + | 
|  | 14 | +Ignite UI for {Platform} {ComponentTitle} には、同じ値を持つ隣接セルを 1 つの大きなセルに結合するセル結合機能があります。結合は列内で縦方向に適用され、重複する値を減らして可読性を向上させます。既定ではデータ値の一致でセル結合されるほか、カスタム条件を設定して結合するように構成できます。 | 
|  | 15 | + | 
|  | 16 | +## {Platform} {ComponentTitle} セル結合の例 | 
|  | 17 | + | 
|  | 18 | +`sample="/{ComponentSample}/cell-merge", height="700", alt="{Platform} {ComponentTitle} セル結合の例"` | 
|  | 19 | + | 
|  | 20 | +## セル結合の有効化と使用 | 
|  | 21 | + | 
|  | 22 | +グリッドでのセル結合は、以下の 2 つのレベルで制御されます: | 
|  | 23 | + - グリッド レベルの結合モード - 結合がいつ適用されるかを決定 | 
|  | 24 | + - 列レベルの結合トグル - どの列でセルを結合できるかを決定 | 
|  | 25 | + | 
|  | 26 | +### グリッド結合モード | 
|  | 27 | + | 
|  | 28 | +グリッドは、`GridCellMergeMode` 列挙型の値を受け入れる `cellMergeMode` プロパティを公開します。 | 
|  | 29 | + - `always` - ソート状態に関係なく、結合条件を満たすすべての隣接セルを結合。 | 
|  | 30 | + - `onSort` - 列がソートされているときのみ隣接セルを結合 **(デフォルト値)**。 | 
|  | 31 | + | 
|  | 32 | +```tsx | 
|  | 33 | +<{ComponentSelector} data={data} cellMergeMode={cellMergeMode} > | 
|  | 34 | +    ... | 
|  | 35 | +</{ComponentSelector}> | 
|  | 36 | +``` | 
|  | 37 | +```tsx | 
|  | 38 | +const cellMergeMode: GridCellMergeMode = 'always'; | 
|  | 39 | +``` | 
|  | 40 | +### 列結合のトグル | 
|  | 41 | + | 
|  | 42 | +列レベルでは、`merge` プロパティで結合の有効または無効を切り替えます。 | 
|  | 43 | + | 
|  | 44 | +```tsx | 
|  | 45 | +<IgrColumn field="OrderID" merge={true}></IgrColumn> | 
|  | 46 | +<IgrColumn field="ShipperName" merge={false}></IgrColumn> | 
|  | 47 | +``` | 
|  | 48 | + | 
|  | 49 | +上記の例では: | 
|  | 50 | + - **OrderID** 列は、隣接する重複値を結合します。 | 
|  | 51 | + - **ShipperName** 列は、結合を行わず通常通りに描画されます。 | 
|  | 52 | + | 
|  | 53 | +### 組み合わせた例 | 
|  | 54 | + | 
|  | 55 | +```tsx | 
|  | 56 | +<{ComponentSelector} data={data} cellMergeMode]={cellMergeMode} autoGenerate={false}> | 
|  | 57 | +    <IgrColumn field="OrderID" header="Order ID" merge={true}></IgrColumn> | 
|  | 58 | +    <IgrColumn field="ShipperName" header="Shipper Name" merge={true}></IgrColumn> | 
|  | 59 | +    <IgrColumn field="Salesperson" header="Salesperson"></IgrColumn> | 
|  | 60 | +</{ComponentSelector}> | 
|  | 61 | +``` | 
|  | 62 | + | 
|  | 63 | +```tsx | 
|  | 64 | +const cellMergeMode: GridCellMergeMode = 'onSort'; | 
|  | 65 | +``` | 
|  | 66 | + | 
|  | 67 | +この例では、グリッドは列がソートされている場合のみ結合を行い、Category 列と Product 列の両方で結合が有効になっています。 | 
|  | 68 | + | 
|  | 69 | +## カスタム結合条件 | 
|  | 70 | + | 
|  | 71 | +`always` と `onSort` の組み込みモードに加えて、`mergeStrategy` プロパティを使用して独自の結合条件を定義することができます。このストラテジでは、セルの比較方法と結合範囲の計算方法の両方を制御します。 | 
|  | 72 | + | 
|  | 73 | +### 結合ストラテジ クラス | 
|  | 74 | + | 
|  | 75 | +カスタム結合ストラテジは `IgrGridMergeStrategy` クラスを実装する必要があります: | 
|  | 76 | + | 
|  | 77 | +```ts | 
|  | 78 | +export declare class IgrGridMergeStrategy { | 
|  | 79 | +    merge: ( | 
|  | 80 | +        data: any[], | 
|  | 81 | +        field: string, | 
|  | 82 | +        comparer: (prevRecord: any, currentRecord: any, field: string) => boolean, | 
|  | 83 | +        result: any[], | 
|  | 84 | +        activeRowIndex?: number, | 
|  | 85 | +        grid?: GridType | 
|  | 86 | +    ) => any[]; | 
|  | 87 | + | 
|  | 88 | +    comparer: (prevRecord: any, record: any, field: string) => boolean;     | 
|  | 89 | +} | 
|  | 90 | +``` | 
|  | 91 | +- `merge` - 結合されたセルをどのように生成するかを定義。 | 
|  | 92 | +- `comparer` - 隣接するレコードを結合すべきかを判定する条件を定義。 | 
|  | 93 | + | 
|  | 94 | +<!-- ComponentStart: Grid, HierarchicalGrid --> | 
|  | 95 | +### デフォルトのストラテジを拡張 | 
|  | 96 | + | 
|  | 97 | +一部の動作 (例: comparer ロジック) のみをカスタマイズしたい場合は、組み込みの `IgrDefaultMergeStrategy` を拡張し、必要なメソッドのみをオーバーライドできます。 | 
|  | 98 | + | 
|  | 99 | +```ts | 
|  | 100 | +export class MyCustomStrategy extends IgrDefaultMergeStrategy { | 
|  | 101 | +    /* Merge only cells within their respective projects */ | 
|  | 102 | +    public override comparer(prevRecord: any, record: any, field: string): boolean { | 
|  | 103 | +        const a = prevRecord[field]; | 
|  | 104 | +        const b = record[field]; | 
|  | 105 | +        const projA = prevRecord['ProjectName']; | 
|  | 106 | +        const projB = record['ProjectName']; | 
|  | 107 | +        return a === b && projA === projB; | 
|  | 108 | +    } | 
|  | 109 | +} | 
|  | 110 | +``` | 
|  | 111 | +<!-- ComponentEnd: Grid, HierarchicalGrid --> | 
|  | 112 | +<!-- ComponentStart: TreeGrid --> | 
|  | 113 | +`IgxTreeGrid` には、`IGridMergeStrategy` を実装する 2 つの組み込みストラテジがあります: `DefaultTreeGridMergeStrategy` と `ByLevelTreeGridMergeStrategy`。`DefaultTreeGridMergeStrategy` は、階層レベルに関係なく同じ値を持つすべてのセルを結合します。`ByLevelTreeGridMergeStrategy` は、同じ階層レベルにあり、かつ同じ値を持つセルのみを結合します。同一階層レベルが結合の必須条件になります。 | 
|  | 114 | + | 
|  | 115 | +### デフォルトのストラテジを拡張 | 
|  | 116 | + | 
|  | 117 | +一部の動作 (例: comparer ロジック) のみをカスタマイズしたい場合は、組み込みの `DefaultTreeGridMergeStrategy` または `ByLevelTreeGridMergeStrategy` のいずれかを拡張し、必要なメソッドのみをオーバーライドできます。 | 
|  | 118 | + | 
|  | 119 | +```ts | 
|  | 120 | +export class MyCustomStrategy extends IgrDefaultTreeGridMergeStrategy { | 
|  | 121 | +    /* Merge only cells within their respective projects */ | 
|  | 122 | +    public override comparer(prevRecord: any, record: any, field: string): boolean { | 
|  | 123 | +        const a = prevRecord[field]; | 
|  | 124 | +        const b = record[field]; | 
|  | 125 | +        const projA = prevRecord['ProjectName']; | 
|  | 126 | +        const projB = record['ProjectName']; | 
|  | 127 | +        return a === b && projA === projB; | 
|  | 128 | +    } | 
|  | 129 | +} | 
|  | 130 | +``` | 
|  | 131 | +<!-- ComponentEnd: TreeGrid --> | 
|  | 132 | + | 
|  | 133 | +### カスタム ストラテジの適用 | 
|  | 134 | + | 
|  | 135 | +定義したカスタム ストラテジは、`mergeStrategy` プロパティを通じてグリッドに割り当てます。 | 
|  | 136 | + | 
|  | 137 | +```tsx | 
|  | 138 | +<{ComponentSelector} data={data} mergeStrategy={customStrategy}> | 
|  | 139 | +  <IgrColumn field="ActionID" merge={true}></IgrColumn> | 
|  | 140 | +  <IgrColumn field="ProjectName" merge={true}></IgrColumn> | 
|  | 141 | +</{ComponentSelector}> | 
|  | 142 | +``` | 
|  | 143 | + | 
|  | 144 | +```ts | 
|  | 145 | +const customStrategy = new MyCustomStrategy() as IgrGridMergeStrategy; | 
|  | 146 | +``` | 
|  | 147 | +<!-- ComponentStart: Grid --> | 
|  | 148 | + | 
|  | 149 | +### デモ | 
|  | 150 | + | 
|  | 151 | +`sample="/{ComponentSample}/cell-merge-custom-sample", height="700", alt="{Platform} {ComponentTitle} セル結合の例"` | 
|  | 152 | +<!-- ComponentEnd: Grid --> | 
|  | 153 | + | 
|  | 154 | +## 機能の統合 | 
|  | 155 | + | 
|  | 156 | +セル結合の特性上、他の機能との連携動作について以下の点に注意が必要です: | 
|  | 157 | +<!-- ComponentStart: Grid --> | 
|  | 158 | +- **展開と縮小**: マスター詳細、グループ化など、データ以外の行を生成する機能がある場合、その位置でセル結合が中断され、グループが分割されます。 | 
|  | 159 | +<!-- ComponentEnd: Grid --> | 
|  | 160 | +- **Excel エクスポート**: 結合されたセルは、Excel にエクスポートしても結合状態が維持されます。 | 
|  | 161 | +- **列のピン固定**: 列がピン固定されてもセルの結合は維持され、ピン固定領域内に表示されます。 | 
|  | 162 | +- **行のピン固定**: セルは自身が属する領域内でのみ結合されます。つまり、ピン固定された行のセルはピン固定行のセル同士で、ピン固定されていない行のセルはその中でのみ結合されます。 | 
|  | 163 | +- **ナビゲーション/アクティベーション**: セルがアクティブになると、その行内の結合セルはすべて単一セルに分解されます。これはキーボード ナビゲーションによるアクティベーションも含みます。 | 
|  | 164 | + | 
|  | 165 | +>[!NOTE] | 
|  | 166 | +> 結合セルをクリックすると、結合シーケンス内でもっとも近いセルがアクティブになります。 | 
|  | 167 | +
 | 
|  | 168 | +- **更新/編集**: アクティブ化によって結合シーケンスが分解されるため、編集モードになるのは単一セルのみです。 | 
|  | 169 | +- **行の選択**: 選択された行が結合セルと交差する場合、関連するすべての結合セルが選択対象としてマークされます。 | 
|  | 170 | + | 
|  | 171 | +<!-- ComponentStart: Grid --> | 
|  | 172 | +## 制限 | 
|  | 173 | +|既知の制限| 説明| | 
|  | 174 | +| --- | --- | | 
|  | 175 | +| セルの結合は、複数行レイアウトとの組み合わせではサポートされません。 | 両方とも複雑なレイアウトを使用するため、同時に使用することはできません。このような無効な構成が検出された場合は警告が表示されます。 | | 
|  | 176 | +<!-- ComponentEnd: Grid --> | 
|  | 177 | + | 
|  | 178 | +## API リファレンス | 
|  | 179 | + | 
|  | 180 | +* `{ComponentName}` | 
|  | 181 | + | 
|  | 182 | +## その他のリソース | 
|  | 183 | + | 
|  | 184 | +* [フィルタリング](filtering.md) | 
|  | 185 | +* [Excel スタイル フィルタリング](excel-style-filtering.md) | 
|  | 186 | +* [仮想化とパフォーマンス](virtualization.md) | 
|  | 187 | +* [ページング](paging.md) | 
|  | 188 | +* [ソート](sorting.md) | 
|  | 189 | +* [集計](summaries.md) | 
|  | 190 | +* [列の移動](column-moving.md) | 
|  | 191 | +* [列のピン固定](column-pinning.md) | 
|  | 192 | +* [列のサイズ変更](column-resizing.md) | 
|  | 193 | +* [選択](selection.md) | 
|  | 194 | + | 
|  | 195 | +コミュニティに参加して新しいアイデアをご提案ください。 | 
|  | 196 | + | 
|  | 197 | +* [{ProductName} **フォーラム (英語)**]({ForumsLink}) | 
|  | 198 | +* [{ProductName} **GitHub (英語)**]({GithubLink}) | 
0 commit comments