tablepress-datatables-colre.../README.md

2.4 KiB

tablepress-datatables-colrejigger

Abstract

allow columns of a Tablepress table to be reordered/resized on the fly in the front end

Description

This project is an extension to the TablePress plug-in (see https://tablepress.org/) for WordPress (https://wordpress.org/). It is not useful without the TablePress plug-in. This project is not part of TablePress, but designed to work with it and extend its capabilities.

Based on the ColReorder and ColResize (see https://github.com/smasala/ColResize) extensions for the DataTables JavaScript library (see https://datatables.net), the tablepress-datatables-colrejigger extension gives you the ability to allow columns of a TablePress table in your WordPress site to be reordered or resized by viewers of the table. This feature may be particularly useful when you want to present more information than can comfortably fit in your page's width and want to allow viewers to arrange it in the way most useful or readable for them.

Installation

Download a release from https://code.studioinfinity.org/glen/tablepress-datatables-colrejigger/releases (as a zip file) and install and activate in your WordPress site like any other extension in zip format.

Usage

This extension operates by adding additional parameters to the [table id=NN /] shortcode. For a list of the provided parameters and their meanings, see the source file tablepress-datatables-colrejigger.php. But one quick example should show how simple this is:

[table id=2 datatables_colreorder=true datatables_colresize_resizetable=true /]

This will present table 2 in the default fashion, except that the page viewer will be able to reorder its columns (by dragging headers) and resize its columns (by dragging the boundaries between headers, indicated by the cursor changing shape). The table will change its total width to accommodate the new column sizes after a resize operation.

Included software

Note that DataTables ColReorder and DataTables ColResize are not part of this project, but are redistributed with it for convenience, under the respective license terms of each of those packages.

Building

To produce an installable zip file, change directories into a git clone of this repository, and simply execute the command in mkplugin.sh (for example, via bash mkplugin.sh). Note that currently you must update the version number in the mkplugin.sh command.