From ee6bff6f99fa52541fdd3338aa1bdee7711e4c21 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 26 Dec 2010 08:19:09 -0500 Subject: [PATCH] When there are many columns in a table, we risk not seeing the search results; so hide the search criteria, with a possibility of showing them. --- js/messages.php | 4 ++++ js/tbl_select.js | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/js/messages.php b/js/messages.php index 761f810dc..c8ff9f907 100644 --- a/js/messages.php +++ b/js/messages.php @@ -85,6 +85,10 @@ $js_messages['strHideQueryBox'] = __('Hide query box'); $js_messages['strShowQueryBox'] = __('Show query box'); $js_messages['strInlineEdit'] = __('Inline Edit'); +/* For tbl_select.js */ +$js_messages['strHideSearchCriteria'] = __('Hide search criteria'); +$js_messages['strShowSearchCriteria'] = __('Show search criteria'); + /* For tbl_change.js */ $js_messages['strIgnore'] = __('Ignore'); diff --git a/js/tbl_select.js b/js/tbl_select.js index 47d124691..6b03cced5 100644 --- a/js/tbl_select.js +++ b/js/tbl_select.js @@ -22,6 +22,24 @@ $(document).ready(function() { cache: 'false' }); + $('') + .html(PMA_messages['strShowSearchCriteria']) + .insertAfter('#tbl_search_form') + // don't show it until we have results on-screen + .hide(); + + $('#togglesearchform').bind('click', function() { + var $link = $(this); + $('#tbl_search_form').slideToggle(); + if ($link.text() == PMA_messages['strHideSearchCriteria']) { + $link.text(PMA_messages['strShowSearchCriteria']); + } else { + $link.text(PMA_messages['strHideSearchCriteria']); + } + // avoid default click action + return false; + }) + /** * Ajax event handler for Table Search * @@ -45,6 +63,12 @@ $(document).ready(function() { if (typeof response == 'string') { // found results $("#searchresults").html(response); + $('#tbl_search_form').hide(); + $('#togglesearchform') + // always start with the Show message + .text(PMA_messages['strShowSearchCriteria']) + // now it's time to show the link + .show(); } else { // error message (zero rows) $("#searchresults").html(response['message']);