What is the "correct" way to get the cell information for a selected row?
What is the "correct" way to get the cell information for a selected row?
Hi,
What is the correct way to get the cell information for each column from a selected row?
I have been playing with DataTables and it's going great, I am hoping now to take the cell information from a selected row and assign it to input texts on the same page as a form. Unfortunately whilst I can successfully select the row from the sample provided here: https://datatables.net/examples/api/select_single_row.html I have been unable to actually do much with the data. I have been playing with the API, specifically row(), column() and cell() with their data() method but with little success. I have also tried fn.TableTools fnGetSelectedData again with little success (always reported undefined).
Simple table initialisation:
//initialise table
var dataTable = $('#example').DataTable({
searching: false,
responsive: true
});
//hide unnecessary columns
dataTable.columns(1).visible(false);
dataTable.columns(2).visible(false);
dataTable.columns(3).visible(false);
dataTable.columns(4).visible(false);
dataTable.columns(5).visible(false);
dataTable.columns(6).visible(false);
dataTable.columns(7).visible(false);
dataTable.columns(8).visible(false);
I would appreciate any help - thanks.
Answers
Additional note, this is the row onclick event
EDIT: Really sorry didn't see the Edit Cog until now :(
The Select manual details how to do this.
Allan