Showing newly added table row using .show("slow")

Posted by Sam Mackrill on Stack Overflow See other posts from Stack Overflow or by Sam Mackrill
Published on 2008-10-15T09:11:34Z Indexed on 2010/06/09 4:42 UTC
Read the original article Hit count: 176

Filed under:

I am cloning a hidden table row then populating it and after validation I want to show the row using a jquery effect ... say .show("slow")

var baseRow = $("#tasks tr#baseTaskLine");
var newRow = baseRow.clone();
var lastRow = $("#tasks tr[id^='TaskLine_']" + dayClass + ":last");

var newRowId;
if (lastRow.length == 0) {
   newRowId = "TaskLine_new0";
}
else {
   newRowId = "TaskLine_new" + lastRow[0].rowIndex;
}

newRow.attr("id", newRowId);

:
[populate new row]
:

if (lastRow.length == 0) {
   baseRow.after(newRow);
}
else {
   lastRow.after(newRow);
}
newRow.hide();
:

:
[validate via webservice call]
:
newRow.show("slow");

This does show the row but it appears instantly. I have tried hiding all the <td> elements of the row then showing those and that does seem to work but some strange styles get added to each <td> which interfere with the formatting i.e. style="display: block;"

© Stack Overflow or respective owner

Related posts about jQuery