This is a migrated thread and some comments may be shown as answers.

Accessing row index from grid row render

1 Answer 1050 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 06 Jun 2019, 01:08 PM
From GridRowProps.render is there a way to do get the row index that I am overlooking? GridCellProps has dataIndex which is what I want, but nothing equivalent seems to be available for the arguments sent to render.
Agnieszka
Top achievements
Rank 1
commented on 23 Mar 2023, 02:21 PM

2023 and still it would be very welcome to have row index there :)
Konstantin Dikov
Telerik team
commented on 24 Mar 2023, 01:17 PM

The GridRowProps have dataIndex which value represents the index of the data item:

  const rowRender = (tr, props) => {
    console.log(props.dataIndex);
    return tr;
  };
  return (
    <Grid
      rowRender={rowRender}

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Jun 2019, 06:29 AM
Hello, Ryan,

Currently, the rowIndex is not part of the rowRender props.

Still, an external counter can be added to the component, that will keep track which is the current row:

https://stackblitz.com/edit/react-dr41vj?file=app/main.jsx

I will check with the team to provide this index directly in the rowRender we will add it in a future version, if there are no concerns about it..

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or