我是wijmo网格的新手。我想为wijmo flexgrid中的每个单元格添加唯一的ID。 谁能帮助实现这一目标?
谢谢
答案 0 :(得分:0)
您将需要处理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}`);
}
}
我创建了一个示例进行演示: