angular wijmo flexgrid add unique id to grid cell

1k Views Asked by At

I am new to wijmo grid. I would like to add unique id for each cell in the wijmo flexgrid. Can anyone help how to achieve this?

Thanks

1

There are 1 best solutions below

0
On

You will need to handle the formatItem event of the FlexGrid and add a different id to each cell.

<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}`);
    }
}

I have created a sample for demonstration:

Sample