How to — Select multiple tables in adminer.php using javascript

CodeEshop
2 min readMay 3, 2024

--

Javascript for Multi-Table Selection in Adminer.php

This code snippet injects functionality into adminer.php to automate selecting specific tables for export.

Youtube Demo

Here’s a breakdown:

  1. Checking for jQuery:
  • It first verifies if jQuery exists ($('#jquerycdn')). If not, it dynamically adds the jQuery library from a CDN (https://code.jquery.com/jquery-2.2.4.min.js).
  • This ensures the script works even if jQuery isn’t pre-loaded in adminer.php.
  1. afterJqueryLoad Function:
  • This function executes after jQuery loads.
  1. adminerCheckboxes Array:
  • It defines an array containing the names of the tables you want to select (e.g., ps_address, ps_address_format etc).
  1. Selecting Tables:
  • The code iterates through the adminerCheckboxes array in reverse order (for...loop).
  • For each table name:
  • It uses jQuery to find the checkbox element with the corresponding value ($(table tbody [value="${adminerCheckboxes[i]}"])).
  • It triggers a click event on the checkbox to simulate selecting it.
  • It then triggers a click event on the element two levels up in the DOM structure (parent().parent().next()) which likely corresponds to the "export" button or action for that table.

In Summary:

This script automates selecting predefined tables for export in adminer.php using jQuery. It dynamically loads jQuery if needed and simulates clicks on checkboxes and potentially export buttons.

Support

For any kind of technical assistance, just mail us at sales@codeeshop.com

You can check our website for your next ecommerce project CodeEshop

--

--

CodeEshop
CodeEshop

Written by CodeEshop

CodeEshop is Add-on for your need and helps enterprises to grow easily with a large range of ready to use and highly customisable eCommerce products.

No responses yet