question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting row index in dataFormat props function ?

See original GitHub issue

I can see dataFormat props func expsoses cell and complete row object.

 dataFormat(cell,row) {}

Is there any way to get row index here ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
raymondsiucommented, Apr 3, 2017

This is gold. Thanks @AllenFang

0reactions
paradise5455commented, May 17, 2018

@AllenFang , if the filter of the column is applied, and any filter is made, the row-id will not start with number “1” because the “ID” here is generated based on the product number. For e.g, if we filter the column “name” with value 4, the row id will will show “4”. Since the ID is generated incremental, thus cannot deal with it.

Goal: Want to to have row_index for id add incremental, and even after filter the column name, the 1st row index will start/count as no.1.

Question: If pagination is applied, the row index will always start with number 1, when we turn to page 2, or page 3. if we used own generated row index as below code, how can we fix that ?

For example code below, try to use this:

indexNumber(cell, row, enumObject, rowIndex) { return (<div>{rowIndex + 1}</div>) }

<TableHeaderColumn ref='id' dataField="id" width='70px' dataSort expandable={false} dataFormat={this.indexNumber} > ID </TableHeaderColumn>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Columns Props · react-bootstrap-table2
Specify the data type on column. Available value so far is string , number , bool and date . Default is string ....
Read more >
How can I get row index if every cell is a child component?
I am currently trying to create a table where row index needs to be displayed for every row. I thought this was a...
Read more >
General Props | Docs and API Reference - React Data Grid
The value of the activeCell should be an array of length 2 , the first value being the row index, while the second...
Read more >
Table Visualization — pandas 1.5.2 documentation - PyData |
Hiding Data#. The index and column headers can be completely hidden, as well subselecting rows or columns that one wishes to exclude. Both...
Read more >
Table Options - Bootstrap Table
See column properties for more details. ... Default: function(index, row, element) { return '' } ... To get loading errors please use onLoadError ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found