Proof of concept to show that jQuery can be used to paginate the results of any SQL query executed on a table. Not a thoroughly tested patch.
The paginate_table.js attaches actions to the navigation form and carries out the AJAX request, inserts the newly retrieved contents into the page. PHP code in sql.php has been modified accordingly and only the necessary contents are printed whenever an AJAX request is made.
Unified diff against a snapshot of git repo as on 2 April 2010 13:00 UTC
Hi Ninad,
the patch is interesting. A few questions:
1. Is there some standard way to show user that there is a new set of data? I guess that the slideUp("slow") is more a test on your part than the intended behavior?
2. You had to disable inline edit?
3. After I use the "Page number" selector then click Next, I see only the top menu and a white page.
Hi Marc,
Re 1: You might have noticed that a div with the 'Loading' message is being added to the page while the request runs. We could update that div and display a success/failure message for 5 or 10 seconds and then hide it. The slideUp() was used so that I could remove the older divs and insert new ones in a smooth fashion. We could use other effects (like fadeIn/Out) or a fixed speed for animations.
Re 2: I noticed that wherever there is a document.write(), my script was failing. I had that issue with PMA_generate_slider_effect() as well. I guess this is an issue with jQuery, and I haven't yet searched to check it out. I'll do that soon.
Re 3: I'm not sure I understood what you did. Could you please explain again? Did you select a Page number from the drop down (<select>)? If that's the case, then there is no jQuery action attached to that by this patch. I've just attached actions to the input fields that have their name as 'navig'. The Page number has name 'pos'.
As I said, this is not a thoroughly tested patch. It fails on tbl_sql.php and db_sql.php (where we can write our own SQL query), have to test it on other pages. Hope to fix these bugs.
About #1, I noticed the "Loading"; I just was not sure about the choice of animation for this, or even about having an animation at all.
About #3, I browse a table which has 137 rows. On page 1, I use the Page number selector to reach page 2. Then I click the Next (>) button and I see only the
top menu and a white page.
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).