# Is there a way to add row numbers for a dashtable?

**URL:** <https://community.plotly.com/t/is-there-a-way-to-add-row-numbers-for-a-dashtable/52464>\
**Category:** Dash Python\
**Created:** [April 28, 2021, 8:13pm UTC](https://community.plotly.com/t/is-there-a-way-to-add-row-numbers-for-a-dashtable/52464 "2021-04-28T20:13:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![schnetzlerjoe](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/schnetzlerjoe/32/12950_2.png) [@schnetzlerjoe](https://community.plotly.com/u/schnetzlerjoe)\
**Post date:** [April 28, 2021, 8:13pm UTC](https://community.plotly.com/t/is-there-a-way-to-add-row-numbers-for-a-dashtable/52464/1 "2021-04-28T20:13:22Z")

</div>

I want to add row numbers 1 through nrow(df) that stays when filtered, sorted etc. Does dashtable support that?

---

<div class="post-metadata">

**Author:** ![AnnMarieW](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AnnMarieW](https://community.plotly.com/u/AnnMarieW)\
**Post date:** [April 28, 2021, 10:21pm UTC](https://community.plotly.com/t/is-there-a-way-to-add-row-numbers-for-a-dashtable/52464/2 "2021-04-28T22:21:47Z")

</div>

Hi @schnetzlerjoe

Yes, the DataTable supports both row numbers and `row_id`

Before you sort or filter your df, you can create a row id like this:

```auto
df['id'] = df.index

```

See more information in the section called “Row IDs” [here](https://dash.plotly.com/datatable/interactivity)
