Invisible Columns for TablePress Search
TablePress is a WordPress plugin to create beautiful functional tables. Its search box is particularly useful. When entities have synonyms, such as gene names like P2X1, with which P2RX1 and P2X purinoceptor 1 are synonymous, one may want to make a table searchable by synonyms while hiding them to keep the table simple.
Here is a list of the Brasilian singer Astrud Gilberto's masterpieces, as an example. Titles in Portuguese and English are shown side by side.
Original title | Title in English | Audio |
---|---|---|
Meditación | Meditation | |
Nunca Mi Amor | Never My Love | |
Insensatez | How Insensitive | |
Agua De Beber | Drinking Water | |
Trenes, Barcos Y Aviones | Trains And Boats And Planes | |
Tristeza | Goodbye Sadness | |
Garota de Ipanema | The Girl from Ipanema |
How to create a searchable invisible column
You can define visibility in CSS as below.
.tablepress .column-N { /* N corresponds to the column number */
color: transparent;
width: 1px;
padding: 0px;
margin: 0px;
font-size: 0px;
}
Let's hide the 2nd column.
Original title | Title in English | Audio |
---|---|---|
Meditación | Meditation | |
Nunca Mi Amor | Never My Love | |
Insensatez | How Insensitive | |
Agua De Beber | Drinking Water | |
Trenes, Barcos Y Aviones | Trains And Boats And Planes | |
Tristeza | Goodbye Sadness | |
Garota de Ipanema | The Girl from Ipanema |
You can still search the table by English titles, although you don't see them anymore. For instance, enter "goodbye sadness" in the search window, and you'll get Tristeza only.
Other potential methods that have turned out to be non-functioning include
Hiding columns in TablePress settings
The search box doesn't work.
CSS display:none
.tablepress .column-N {
display: none;
}
The search box doesn't work.
CSS visibility:hidden
.tablepress .column-N {
visibility: hidden;
}
Again, the search box doesn't work.