如何获取AgGrid中的行索引?

时间:2019-11-03 11:56:13

标签: reactjs ag-grid

我想在AgGrid中获取行的索引。我该怎么办?

{
  headerName: 'row',
  align: 'center' as const,
  dataIndex: 'id',
  key: 'id',
  width: 20,
  valueGetter: column => column.rowIndex + 1,
},

1 个答案:

答案 0 :(得分:0)

根据Ag-grid文档:

您可以尝试以下操作:

{
      headerName: 'row',
      align: 'center' as const,
      dataIndex: 'id',
      key: 'id',
      width: 20,
      valueGetter: params => params.node.rowIndex + 1,
},
相关问题