From: Barış Metin Date: Thu, 9 Apr 2009 15:19:25 +0000 (+0000) Subject: make the search more interactive and less cpu hangry with a timeout and closure. X-Git-Tag: PLEWWW-4.3-6~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ddef0e4f0e841a27c23ea5f2e6d9583908258ca3;hp=ba63e894c264216a4a1003d80fad5b8ce6f279bc;p=plewww.git make the search more interactive and less cpu hangry with a timeout and closure. --- diff --git a/plekit/table/table.js b/plekit/table/table.js index 8656af9..14c7220 100644 --- a/plekit/table/table.js +++ b/plekit/table/table.js @@ -102,9 +102,18 @@ function plekit_tr_text (tr) { return text; } +var plekit_table_filter_timeout = null; /* scan the table, and mark as visible the rows that match (either AND or OR the patterns) */ -function plekit_table_filter (table_id,pattern_id,and_id) { +function plekit_table_filter(table_id,pattern_id,and_id) { + clearTimeout(plekit_table_filter_timeout); + plekit_table_filter_timeout = setTimeout(function() { + plekit_lazy_table_filter(table_id,pattern_id,and_id) + }, + 200); +} + +function plekit_lazy_table_filter (table_id,pattern_id,and_id) { var table=$(table_id); var css='#'+table_id+'>tbody'; var rows = $$(css)[0].rows;