Our Biggest Sale Is Here
Up to 70% Off
Get the Deal

How to add an index column with row numbers in wpDataTables

Say your football league table is sorted by the Position column, and visitors sort it by goals scored to see the best attacks. An index column numbers the rows as they appear on the screen, 1, 2, 3 and so on. After every sort or filter, the numbers start again from 1, so visitors always see the place of each row in the current view.

How do I add an index column?

Turn on Add index column in the Advanced tab and move the column where you want it.

  1. Open the table settings. Go to wpDataTables → wpDataTables and click the table title.
  2. Turn on the index column. In the Advanced tab (marked NEW!), turn on Add index column under Index column. After you save, the column is added as the last column.
  3. Move the column. Click Column List and drag the index column to the first position.
  4. Save the table. Click Save Changes.

How does the index column count the rows?

The index column counts the rows in the order visitors see them, not in the order of the source:

What the visitor does What the index column shows
Opens the page 1, 2, 3 in the default sort order
Sorts by another column, for example Goals for 1, 2, 3 again, in the new order. The team with the most goals is 1.
Filters the table, for example to teams with a negative goal difference 1, 2, 3 for the rows that are left

The index column isn’t saved in the data source. If the rank must stay the same after sorting, such as a league position, keep it as a column in your data.

What should I remember about the index column?

Turn on Add index column in the Advanced tab, then move the column with the Column List. It always numbers the visible rows from 1, after every sort and filter, so keep fixed ranks as a column in your data.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box