Commit 4fd9597df24b499994b3a22122ff771ad87e1f09
1 parent
6550f634
sprawdzanie czy na pewno pokazać wynik wyszukiwania
--HG-- branch : beta
Showing
5 changed files
with
20 additions
and
14 deletions
common/locale/en/LC_MESSAGES/django.po
common/static/js/slickgrid.js
... | ... | @@ -61,11 +61,17 @@ var slickgrid = { |
61 | 61 | return slickgrid.grid.getDataItem(row).id; |
62 | 62 | }, |
63 | 63 | |
64 | + search_counter: 0, | |
65 | + | |
64 | 66 | scroll_search: function() { |
65 | 67 | "use strict"; |
66 | - slickgrid.loader.searchRow(slickgrid.search_string(), function (row) { | |
67 | - slickgrid.set_active_when_loaded = row; | |
68 | - slickgrid.grid.scrollRowToCenter(row); | |
68 | + slickgrid.search_counter++; | |
69 | + slickgrid.loader.onDataLoading.notify(); | |
70 | + slickgrid.loader.searchRow( | |
71 | + slickgrid.search_counter, slickgrid.search_string(), | |
72 | + function (row) { | |
73 | + slickgrid.set_active_when_loaded = row; | |
74 | + slickgrid.grid.scrollRowToCenter(row); | |
69 | 75 | }); |
70 | 76 | }, |
71 | 77 | |
... | ... | @@ -421,14 +427,15 @@ $(function() { |
421 | 427 | }); |
422 | 428 | |
423 | 429 | // wyszukiwanie |
424 | - var search_timeout_handler; | |
430 | + //var search_timeout_handler; | |
425 | 431 | $('#text-search').keyup(function (e) { |
426 | 432 | if (e.which === 13) { |
427 | - clearTimeout(search_timeout_handler); | |
433 | + //clearTimeout(search_timeout_handler); | |
428 | 434 | slickgrid.search_enter(); |
429 | 435 | } else if ($dj.auto_search) { |
430 | - clearTimeout(search_timeout_handler); | |
431 | - search_timeout_handler = setTimeout(slickgrid.search, 500); | |
436 | + //clearTimeout(search_timeout_handler); | |
437 | + //search_timeout_handler = setTimeout(slickgrid.search, 500); | |
438 | + slickgrid.search(); | |
432 | 439 | } |
433 | 440 | }); |
434 | 441 | |
... | ... |
dictionary/locale/en/LC_MESSAGES/django.po
dictionary/static/js/lexeme-view.js
dictionary/static/js/remotemodel.js
1 | -/* global Slick */ | |
1 | +/* global Slick, slickgrid */ | |
2 | 2 | |
3 | 3 | (function ($) { |
4 | 4 | "use strict"; |
... | ... | @@ -163,7 +163,7 @@ |
163 | 163 | return filter; |
164 | 164 | } |
165 | 165 | |
166 | - function searchRow(search_text, callback) { | |
166 | + function searchRow(search_counter, search_text, callback) { | |
167 | 167 | var data = { |
168 | 168 | filter: filter, |
169 | 169 | sort_rules: sort_rules, |
... | ... | @@ -175,7 +175,8 @@ |
175 | 175 | method: 'get', |
176 | 176 | data: data, |
177 | 177 | callback: function(data) { |
178 | - if ($('#text-search').val() === search_text) | |
178 | + if ($('#text-search').val() === search_text && | |
179 | + slickgrid.search_counter === search_counter) | |
179 | 180 | callback(data.index); |
180 | 181 | } |
181 | 182 | }); |
... | ... |