algorithm - jQuery Performance Issue -


i have performance issue when use code more 1000 <tr> rows

the idea have tags <tr> inside have td text , i'm trying hide , show if text contains or not. code works, more 1000 <tr> info have lot of delay. there way make faster? code called when text change, called less keypress (the original way wanted)

var grilla = $(control).parent().parent().next().next();   var texto = $.trim($(control).val());       if(texto.length < 2){         grilla.children().children().children().children('tr').show(200);         return false;     }      var renglones = grilla.children().children().children().children("tr");     if($(renglones).children('td:first').children().is('[type=text]')){         console.info('busca en inputs');             buscargrillainputs(renglones,texto);             return false;     }      $.each( renglones, function() {         if (!$(this).children('td').is(':contains('+texto.tolowercase()+')') && !$(this).children('td').is(':contains('+texto.touppercase()+')')){             $(this).hide(200);         }         else{             $(this).show(200);         }      }); 

i tried using contains selector @ 1 point , found performance slow. have better luck $.filter

also .show(200) hurt you. there such large number of entries run through run .show() same .hide()

http://jsfiddle.net/seanwessell/e7yvrta1/

$('#search').on('input propertychange paste', function () {     var phrase = this.value;     $('tr').hide();     $('table input').filter(function () {         return this.value.tolowercase().indexof(phrase) != -1;     }).closest('tr').show();  }); 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -