Hi,
I'm using this plugin to enable drag and drop table rows on a page. The plugin comes with a serialize function, which passes the ID of each table row to an AJAX function, like this:
serializeTable: function(table) {
var result = "";
var tableId = table.id;
var rows = table.rows;
for (var i=0; i<rows.length; i++) {
if (result.length > 0) result += "&";
var rowId = rows[i].id;
if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
}
result += tableId + '[]=' + rowId;
}
return result;
},
Unfortunately, the HTML ID of the row is not of much use to me. Instead, I'm trying to pass the value contained within the first TD of the row, but as of yet I'm not having much luck.
I've been trying to replace the rowId variable with something like this, but all it returns is 'undefined'.
var val = $(rowId + "td:nth-child(1)").value;
Is there a simple way to do this? Once I get the correct values to the PHP script I will be fine, but I am still quite inexperienced with javascript.
Any advice would be appreciated. Thanks.