FlexGridでは、コンテンツ依存のセル結合がサポートされています。
セル結合を有効にするには、結合するグリッドの部分を示すallowMergingプロパティを設定し、特定の行および列のallowMergingプロパティをtrueに設定します。これで、グリッド内の同じコンテンツを持つセルが結合されて、データが視覚的にグループ化されます。
次の例では、「国」列と「有効」列に対してallowMergingプロパティがtrueに設定されます。
import * as wjGrid from '@mescius/wijmo.grid';
import * as wjCore from '@mescius/wijmo';
function init() {
var theGrid = new wjGrid.FlexGrid('#theGrid', {
allowMerging: 'Cells',
isReadOnly: true,
showAlternatingRows: false,
autoGenerateColumns: false,
columns: [
{ binding: 'country', header: '国', allowMerging: true },
{ binding: 'sales', header: '売上', format: 'n2' },
{ binding: 'expenses', header: '費用', format: 'n2' },
{ binding: 'active', header: '有効', allowMerging: true },
],
itemsSource: new wjCore.CollectionView(data, {
sortDescriptions: ['country', 'active']
})
});
}