Commit 4fd9597df24b499994b3a22122ff771ad87e1f09

Authored by janek37
1 parent 6550f634

sprawdzanie czy na pewno pokazać wynik wyszukiwania

--HG--
branch : beta
common/locale/en/LC_MESSAGES/django.po
... ... @@ -109,4 +109,4 @@ msgstr "Settings"
109 109  
110 110 #: templates/reader_base.html:31
111 111 msgid "język interfejsu"
112   -msgstr ""
  112 +msgstr "interface language"
... ...
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
... ... @@ -571,9 +571,6 @@ msgstr "Confirm"
571 571 #~ msgid "ustawienia"
572 572 #~ msgstr "settings"
573 573  
574   -#~ msgid "język interfejsu"
575   -#~ msgstr "interface language"
576   -
577 574 #~ msgid "pomoc"
578 575 #~ msgstr "help"
579 576  
... ...
dictionary/static/js/lexeme-view.js
... ... @@ -350,6 +350,7 @@ $.extend(slickgrid, {
350 350 search_enter: function() {
351 351 // lista leksemów z daną formą
352 352 "use strict";
  353 + slickgrid.search_counter++;
353 354 if ($dj.ajax_search_by_form) {
354 355 $.ajaxJSON({
355 356 url: $dj.ajax_search_by_form,
... ...
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 });
... ...