Invisible Columns for TablePress Search

TablePress logo

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 titleTitle in EnglishAudio
MeditaciónMeditation
Astrud Gilberto - Meditation
Nunca Mi AmorNever My Love
Astrud Gilberto: Never My Love
InsensatezHow Insensitive
Insensatez [How Insensitive] - Stan Getz and Astrud Gilberto
Agua De BeberDrinking Water
Astrud Gilberto - AGUA DE BEBER - 1965 Stereo!
Trenes, Barcos Y AvionesTrains And Boats And Planes
Trains And Boats And Planes
TristezaGoodbye Sadness
Garota de IpanemaThe Girl from Ipanema
"The Girl from Ipanema" Astrud Gilberto, João Gilberto and Stan Getz

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 titleTitle in EnglishAudio
MeditaciónMeditation
Astrud Gilberto - Meditation
Nunca Mi AmorNever My Love
Astrud Gilberto: Never My Love
InsensatezHow Insensitive
Insensatez [How Insensitive] - Stan Getz and Astrud Gilberto
Agua De BeberDrinking Water
Astrud Gilberto - AGUA DE BEBER - 1965 Stereo!
Trenes, Barcos Y AvionesTrains And Boats And Planes
Trains And Boats And Planes
TristezaGoodbye Sadness
Garota de IpanemaThe Girl from Ipanema
"The Girl from Ipanema" Astrud Gilberto, João Gilberto and Stan Getz

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.

Leave a Reply

Your email address will not be published. Required fields are marked *