From ddef0e4f0e841a27c23ea5f2e6d9583908258ca3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Thu, 9 Apr 2009 15:19:25 +0000 Subject: [PATCH 1/1] make the search more interactive and less cpu hangry with a timeout and closure. --- plekit/table/table.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; -- 2.43.0