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.

This commit is contained in:
Marc Delisle
2010-12-26 08:19:09 -05:00
parent 3a0e757640
commit ee6bff6f99
2 changed files with 28 additions and 0 deletions

View File

@@ -22,6 +22,24 @@ $(document).ready(function() {
cache: 'false'
});
$('<a id="togglesearchform"></a>')
.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']);