1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * @fileoverview JavaScript functions used on tbl_select.php
6 * @requires js/functions.js
10 * Ajax event handlers for this page
12 * Actions ajaxified here:
15 $(document).ready(function() {
18 * Set a parameter for all Ajax queries made on this page. Don't let the
19 * web server serve cached pages
26 * Prepare a div containing a link, otherwise it's incorrectly displayed
27 * after a couple of clicks
29 $('<div id="togglesearchformdiv"><a id="togglesearchformlink"></a></div>')
30 .insertAfter('#tbl_search_form')
31 // don't show it until we have results on-screen
34 $('#togglesearchformlink')
35 .html(PMA_messages['strShowSearchCriteria'])
36 .bind('click', function() {
38 $('#tbl_search_form').slideToggle();
39 if ($link.text() == PMA_messages['strHideSearchCriteria']) {
40 $link.text(PMA_messages['strShowSearchCriteria']);
42 $link.text(PMA_messages['strHideSearchCriteria']);
44 // avoid default click action
49 * Ajax event handler for Table Search
51 * (see $GLOBALS['cfg']['AjaxEnable'])
52 * @uses PMA_ajaxShowMessage()
54 $("#tbl_search_form.ajax").live('submit', function(event) {
55 // jQuery object to reuse
56 $search_form = $(this);
57 event.preventDefault();
59 // empty previous search results while we are waiting for new results
60 $("#sqlqueryresults").empty();
61 PMA_ajaxShowMessage(PMA_messages['strSearching']);
63 // add this hidden field just once
64 if (! $search_form.find('input:hidden').is('#ajax_request_hidden')) {
65 $search_form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
68 $.post($search_form.attr('action'), $search_form.serialize(), function(response) {
69 if (typeof response == 'string') {
71 $("#sqlqueryresults").html(response);
72 $("#sqlqueryresults").trigger('appendAnchor');
74 // work around for bug #3168569 - Issue on toggling the "Hide search criteria" in chrome.
77 $('#togglesearchformlink')
78 // always start with the Show message
79 .text(PMA_messages['strShowSearchCriteria'])
80 $('#togglesearchformdiv')
81 // now it's time to show the div containing the link
84 // error message (zero rows)
85 $("#sqlqueryresults").html(response['message']);
89 }, 'top.frame_content'); // end $(document).ready()