I have a label that sits within a grid that is populated automatically by an array from a DB via a rest call.
I need to figure out how to add a row to the end of this grid using javascript - as it is a comments grid.
I will then update the database with the new comment.
I've tried using the following code:
<code>
var commentgrid = $(commentgridc).find("[name='comment_grid']");
console.log("comments length:"+$(commentgrid).length);
var comments = $(commentgrid).find("[name='comments']");
console.log("commentgrid:"+$(comments).attr('name'));
//
// Now we have the comments grid name, lets duplicate the last row
//
var $tr = $(commentgrid).find('tr:last').clone();
$(commentgrid).append($tr);
</code>
this sort of works, but doesn't duplicate the last row, it seems to duplicate all rows a couple of times.
Can someone help me with this please? I simply want a new row created that has the same label so I can set the label contents.