I have a table of data (with 20 columns) that I am displaying using dataTables. I also have an assignment button (id=assign). What I am trying to do is copy the data in column#14 to column#20 when i click the button. I might do this on all the rows or a selection of them. my code looks like this.
What is happening is that the copying occurs in the first row and then stops. I get no errors in firebug. when i do an alert(mydata); I see all the information that is supposed to be there. Any pointers to what i am missing would be greatly appreciated.
$(document).ready(function() {
var oTable = $('#myTable').dataTable();
$('#assign').click(function() {
var selectedRecords = oTable.fnSettings().aiDisplay; //gives an array of row indices
for(i=0;i<selectedRecords.length; i++) {
mynodes[i] = oTable.fnGetNodes(selectedRecords[i]); //get row node from index
mydata[i] = oTable.fnGetData(mynodes[i],13); //get column data from node and column number
oTable.fnUpdate(mydata[i],mynodes[i],19); //copy column data to new column
}
});
});
What is happening is that the copying occurs in the first row and then stops. I get no errors in firebug. when i do an alert(mydata); I see all the information that is supposed to be there. Any pointers to what i am missing would be greatly appreciated.