DataTables / Plugins

Plug-ins for DataTables
Other
1.05k stars 1.73k forks source link

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

Open sathyaprakash94 opened 5 years ago

sathyaprakash94 commented 5 years ago

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

romanstingler commented 4 years ago

do you have a LIMIT and an ORDER BY in your query, these are non-deterministic unless you add an additional deterministic sort field like an id