I'm trying to loop through the rows in my jQuery datatable to pull out certain row information and insert it into my array which I will later use in the AJAX call.
I understand I could use the .each in Datatables, but I only want some of the columns (I have HTML edit/delete that I don't need in the JSON)
The current set up is similar to:
//Create the array
var myArray = new Array();
var oTable = $('#myDataTable').dataTable();
var tableLength = oTable.fnGetData().length;
//Step through table
for (var i = 0; i < tableLength; i++) {
myArray[i][0] = oTable.fnGetData(i, 0);
myArray[i][1] = oTable.fnGetData(i, 1);
myArray[i][2] = oTable.fnGetData(i, 3);
myArray[i][3] = oTable.fnGetData(i, 4);
}
//Stringify the object
jsonArray = JSON.stringify(myArray);
Perhaps my syntax is off for fnGetData? The reference sheet does say the parameters are (row, node). Is this the correct way to step through this table getting only certain values?