Issue with getting row data after a sort

Issue with getting row data after a sort

parsonsparsonsparsonsparsons Posts: 29Questions: 8Answers: 0

I have a datatable and am getting my row data like this:

label onclick event: onclick='openEditDialog(this)'

function openEditDialog(btnClicked) {
var selectedRow = $(btnClicked).closest('tr').index();
var tableToEdit = ($(btnClicked).closest('table').attr("id"));
var table = $("#" + tableToEdit).DataTable();
var data = table.row(selectedRow).data();
}

Data is correct before I sort, however after I sort, data becomes incorrect.

If I had a list of 1, 2, 3 and sorted to 3, 2, 1, then clicked on the row with 3 in it my data would be 1. Any idea what im doing wrong? Thanks.

Answers

This discussion has been closed.