DataTables / DataTables/Plugins

indexing to the row data mismatch when exporting table to pdf.

Open
#438 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Indexing to row data is mismatch when exporting PDF. Im facing this problem only using pagination, without pagination with all data filter its working fine.
But when comes with pagination each page row index are mismatching, indexing incorrectly assigning to the rows. I have tried the following code to render the row data and the indexing.

"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { var index = iDisplayIndexFull + 1; $('td:first', nRow).html(index); return nRow; },

nRow returning the records only in the view of pagination, if i move on to the 10th or 15th page the data inside the first page pagination view changed like no 11, 12, 13 instead of displaying 1,2,3 like that randomly it is changed with another indexing nos.

I attached the snapshot of the problem herewith for better understanding. I have tried most of scripts said in the DataTable but not works. The 1st page with indexing are incorrectly mapped when switching between the pages in the pagination.

dataTblIssue1
dataTblIssue2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with DataTables pagination, PDF export, and the provided fnRowCallback snippet. Compare the first-column indexes after moving between pages and verify that each exported page keeps the intended row numbering; the issue is complete when pagination no longer remaps indexes incorrectly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.