Row number in Datatable

UI Components for Angular
Post Reply
ionian
Posts: 4
Joined: 19 Apr 2016, 10:54

16 Jun 2016, 14:01

Hi

I need to show row index number on my Datatable widget to provide an excel like experience for my users. Is there any easy way to accomplish this task?

thanks...

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Jun 2016, 17:03

It is passes as rowIndex;

Code: Select all

<p-column header="Index">
    <template let-i="rowIndex">
        {{i}}
    </template>
</p-column>

ionian
Posts: 4
Joined: 19 Apr 2016, 10:54

16 Jun 2016, 17:31

Thank you, it works!

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

19 Jun 2016, 10:35

Good to hear!

jenny2016
Posts: 6
Joined: 16 Sep 2016, 08:08

23 Sep 2016, 19:04

I used the same way to get row index.
but if I insert a row at the beginning of table, then row index will mess up. it will show two 0 and 1, 2, 3...
it seems rowindex is not dynamically changed.

Should we have a fix for this?

JiroDan
Posts: 20
Joined: 14 Jul 2016, 22:07

25 Oct 2016, 23:03

I'm tracking down an issue that it indeed looks like the row index is not being changed as well, looking at the code next...

Sumei
Posts: 4
Joined: 24 Jan 2017, 03:36

24 Jan 2017, 03:51

Hi, after I updated the primeng, the rowIndex does not work and it display NaN in the datatable.

My code is written like this:

Code: Select all

<p-column field="" header="#" [style]="{width:'5%','text-align':'left'}">
		<template let-i="absRowIndex" pTemplate="body">
			{{i+1}}
		</template>
	</p-column>

Samisama
Posts: 16
Joined: 19 Sep 2016, 10:53

24 Jan 2017, 10:22

I see that you use

Code: Select all

let-i="absRowIndex"
instead of

Code: Select all

let-i="rowIndex"
maybe that should correct your problem ?

Sumei
Posts: 4
Joined: 24 Jan 2017, 03:36

24 Jan 2017, 10:54

No, using 'rowIndex' does not work either

kalempir
Posts: 17
Joined: 02 Oct 2016, 10:21

01 Feb 2017, 12:25

Sumei wrote:No, using 'rowIndex' does not work either
The same issue occurred after updating to ^2.0.0-rc.2. Previous version was ^1.0.0.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests