jquery - Detaching, manipulating, appending -


i reading jqfundamentals weekend, , rebecca murphey talks about:

the $.fn.detach method extremely valuable if doing heavy manipulation element. in case, it's beneficial $.fn.detach element page, work on in code, , restore page when you're done.

i have table sort this, got "learning jquery", page 140:

var rows = $table.find('tr:not(:has(th))').get(); rows.sort(function(rowa,rowb) { ... }); $.each(rows, function(index,row) {   $table.children('tbody').append(row); }); 

i wonder if should detach table , reattach it?

detaching element removes dom. so, if detach the table element, whole table disappear or "flash" until re-insert table dom.

however, may want detach tbody element dom , reinsert table when done sorting rows.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -