我是 wijmo 网格的新手。我想为 wijmo flexgrid 中的每个单元格添加唯一的 ID。谁能帮助如何实现这一目标?
谢谢
您将需要处理 FlexGrid 的 formatItem 事件并向每个单元格添加不同的 id。
<wj-flex-grid [itemsSource]="source" (formatItem)="onFormatItem(grid, $event)" #grid>
<wj-flex-grid-column header="Country" binding="country"></wj-flex-grid-column>
<wj-flex-grid-column header="Date" binding="date"></wj-flex-grid-column>
<wj-flex-grid-column header="Amount" binding="amount"></wj-flex-grid-column>
</wj-flex-grid>
onFormatItem(s, e) {
if(s.cells === e.panel) {
e.cell.setAttribute('id', `row-${e.row}-col-${e.col}`);
}
}
我创建了一个示例进行演示: