How to Use TablePress
Posted on Mar 3, 2015 in PluginsAdd New Table
Navigate to Tablepress > Add New Table
Enter Table Name, Table Description, Number of Rows and Columns > Add Table
And a new blank table is created.
Import a Table
Navigate to Tablepress > Import a Table
Select table file and upload to WordPress. Support format including CSV, XLS and XLSX.
Edit Table
Navigate to Tablepress > All Tables
Hover mouse to the table file intended to edit > Edit
To insert a table into a page, post, or text widget, copy its Shortcode
and paste it at the desired place in the editor. Each table has a unique ID that needs to be adjusted in that Shortcode.
Insert Table Into a Page
To insert the table into a page, post, or text widget, copy the Shortcode
and paste it at the desired place in the editor.
Additionally, there is a Insert a Table from Tablepress tool in the editor to help you generate and insert the Shortcode into the page.
Use Custom Commands
Order Table – “order” command
Scroll down to the end of Edit Table
Set Parameter
“order”: [[0, ‘asc’]]
Using this parameter you can define which column(s) the order is performed upon, and the ordering direction.
The order must be an array of arrays, each inner array comprised of two elements:
- Column index to order upon (‘0’ represents 1st. Column, ‘1’ represents 2nd. Column, and so on)
- Direction so order to apply (
asc
ordesc
)
Example 1:
Table of Hawaii Agriculture Food Products – Order by 1st. column (Item)
Custom Command parameter:
Example 2:
Table of Hawaii Agriculture Food Products – Order by 2nd. column (Island) then 1st. column (Item)
Custom Command parameter:
Pagination – “pagingType” command
Scroll down to the end of Edit Table
Set parameter
“pagingType”: “simple_numbers” [Default]
DataTables has four built-in paging button arrangements:
- simple – ‘Previous’ and ‘Next’ buttons only
- simple_numbers – ‘Previous’ and ‘Next’ buttons, plus page numbers
- full – ‘First’, ‘Previous’, ‘Next’ and ‘Last’ buttons
- full_numbers – ‘First’, ‘Previous’, ‘Next’ and ‘Last’ buttons, plus page numbers
Example 1:
Table of Hawaii Agriculture Food Products
“pagingType”: “simple”
Example 2:
Table of Hawaii Agriculture Food Products
“pagingType”: “simple_numbers”
Example 3:
Table of Hawaii Agriculture Food Products
“pagingType”: “full”
Example 4:
Table of Hawaii Agriculture Food Products
“pagingType”: “full_numbers”
Enable Horizontal Scrooll
Scroll down to the end of Edit Table, check on “Enable horizontal scrolling”.
It also can be done by adding a command on custom command.
Set parameter
“scrollX”: true
Example:
Hawaii Farmers’ Market
Enable vertical scrolling
Enable vertical scrolling. Vertical scrolling will constrain the DataTable to the given height, and enable scrolling for any data which overflows the current viewport. This can be used as an alternative to paging to display a lot of data in a small area (although paging and scrolling can both be enabled at the same time if desired).
Scroll down to the end of Edit Table:
Set Parameter
“scrollY”: “200px”, “scrollCollapse”: true, “paging”: false
Example:
Public Charging Stations
Set Column Widths
Column widths can be done with the following CSS code, which can be added to the “Custom CSS” textarea in the “Plugin Options” (TablePress > Plugin Options):
”
.tablepress-id-N .column-2 { width: 30%; }
”
The N
needs to be changed to the ID of the table in question (or use.tablepress
as the first part of the selector, if you want this to apply to all tables).
Column Filters
TablePress Extension: DataTables ColumnFilterWidgets required.
Ex. [table id=2 datatables_columnfilterwidgets=true datatables_columnfilterwidgets_exclude_columns=1,2,3,4 /]