I'm trying to do something simple: display the row number on a primereact / components / datatable / DataTable column.
Problem is that the only way it seems possible is by adding a data field with indexes, which get scrambled if sorting is turned on.
I don't want to add data field.
<DataTable
value={this.props.state.communitylist}
paginator={true}
rows={10}
rowsPerPageOptions={[10, 20, 30, 50]}
header={header}
globalFilter={this.state.globalFilter}
scrollable={true}
responsive={true}>
<Column field="shortId" header="ShortId"/>
<Column field="country" header="Country"/>
<Column field="city" header="City"/>
<Column field="partners" header="Partners"/>
<Column header="Action" body={this.actionButtons}
style={{textAlign: 'center', width: '10em'}}/>
</DataTable>
As you can see first column is shortId
. this is database field. I don't want to this.
I want to automation increment number without database field instead of shortId
.
Ideally there would be a method that allows for this but I can't seem to find any.