2009-12-15 7 views
3

C'est ce que je fais pour ajouter une nouvelle ligne dans le tableau: -Comment ajouter une nouvelle ligne dans une table avec animation en utilisant jQuery?

function expandAll(){ 
     $('#myTableID>tbody>tr>td:nth-child(2)>div:nth-child(2)').each (function() { 
      html = $(this).html(); 
// Is it possible to add this Row with animation 
      $(this).parent().parent().after("<tr><td colspan='2'>&nbsp;</td><td colspan='15'>" + html + "</td></tr>").slideDown('slow');   
     }); 
    } 

Je suis en mesure d'ajouter une nouvelle ligne, mais il n'y a pas d'effet de l'utilisation slideDown.

+0

Que diriez-vous si vous animez changer la hauteur de l'élément qui est ajouté. –

+0

@James: c'est acceptable. comment faire ça? –

Répondre

6

Si vous avez JQuery 1.3.2, vous pouvez le faire:

$("<your row html>").hide().insertAfter($(this).parent().parent()).slideDown('slow'); 
Questions connexes