I am currently in the process of dynamically creating a table, but I am facing an issue with the number of cells being added.
The table I am trying to create has a total of 8 columns (Monday to Friday and a total column at the end).
You can view my progress on this fiddle: http://jsfiddle.net/kaf9qmh0/
As you can see, there seems to be a problem where it adds 8 columns three times on row one, then two times on row two, before finally correctly adding only 8 columns on the last row.
My suspicion is that the issue lies in how I am using the .append method to add rows (line 105 in the fiddle), but due to my limited knowledge in Javascript, I am unsure about how to prevent the additional columns from being added to row 1 and row 2.
$("#timesheetTable > tbody").append('<tr id="' + sourceTableRowID + '" data-tt-id="' + sourceTableRowID + '" class="timesheetRow row' + rowIndex2 + '"></tr>');
Could someone offer guidance on how I can ensure that the cells (td) are only added to the next row when looping through rowIndex2 and incrementing it?
Any assistance in pointing me in the right direction would be greatly appreciated.