Finding ids of rows in selected column

Hello everyone,

I made a design that performs crud operations on Django FW. I want to select a column and edit the values in that column all in one. I think, I need to keep the row ids of the rows in selected column within an array. Any ideas? Thank you.

$('#example tbody').on('click', 'tr', function () {
    $(this).toggleClass('selected');
});
$('#button').click(function () {
    alert(table.rows('.selected').data().length + ' row(s) selected');
    console.log(table.rows('.selected').data()[0].id);
});

{id: 15, p_id_s: “V3A”, reception_date: “2022-07-05”, hospital_date: “2022-07-15”, culture: “LJ”, …}
Console output: 15

I am able to reach id with that code but I have multi select operation and I need to keep all ids in an array. Do you have any idea how to do that? Thank you.

You don’t need to track those separately. If the id is a field on the row (hidden or not), you can get the id from the current row by accessing that column.

1 Like