Material-table: Any way to get Serial Numbers in the data table ?

Created on 31 Jan 2019  路  15Comments  路  Source: mbrn/material-table

In Addition to the data that I'm getting I want show the Serial Number in 1st Column ? Is this possible ?

feature

All 15 comments

Hi @Prasad-YS,

I can do this for next releases.

@Prasad-YS

You do this with current version. We already have an tableData.id field on every row of data. Just add a new column like this: columns: { title: '#', field: 'tableData.id' }

title: '#', field: 'tableData.id'

Sorry, Didn't get any number, just got a blank column

Which version of material-table do you use?

I'm using 1.13.0

Can you share your material-table usage code

Updated to new version, Got the serial number now, Thanks lot for your support

Is it possible to make the tableData.id start from 1 instead of 0?

@mbrn Is it possible to make the tableData.id start from 1 instead of 0??

@ahsan-baloch just do tableData.id + 1

@ahsan-baloch
{ title: '#', field: 'tableData.id', render:rowData => { return( <p>{rowData.tableData.id+1}</p> ) } }

@ahsan-baloch
{ title: '#', field: 'tableData.id', render:rowData => { return( <p>{rowData.tableData.id+1}</p> ) } }

but with thet when exported to pdf or csv the count shows from 0 not 1

@ahsan-baloch just do tableData.id + 1

render: (rowData) => rowData.tableData.id + 1
this worked for me but still when exporting it into csv or pdf count starts from 0 not 1

@ahsan-baloch you could first customize the data before it begins writing to CSV. you'll have to look around for that unfortunately coz i used another package as I didn't know material table supported exporting to CSV.

@ahsan-baloch you could first customize the data before it begins writing to CSV. you'll have to look around for that unfortunately coz i used another package as I didn't know material table supported exporting to CSV.

ahh okay thanks for the help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

behrouz-s picture behrouz-s  路  3Comments

revskill10 picture revskill10  路  3Comments

VipinJoshi picture VipinJoshi  路  3Comments

Mihier-Roy picture Mihier-Roy  路  3Comments

bohrsty picture bohrsty  路  3Comments