How to hide hr if table filter is empty

sa_mejia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2021

Hello

I'm trying to hide a <hr/> rule inside a table filter when the table filter returns no values. 
Is there any way to achieve this? Screenshot_11.png

1 answer

1 vote
Katerina Kovriga _Stiltsoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2021

Hi @sa_mejia ,

I can suggest wrapping your Table Filter macro into the Table Transformer macro:

2021-03-05_12h20_46.png

2021-03-05_12h21_00.png

2021-03-05_12h21_06.png

So when you don't have any suitable rows to display, you'll get a blue info message that there are no any rows returned (not the empty table header row as you had before).

sa_mejia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2021

Hi. 
Thanks for your reply, 
I was thinking in something that allows me to hide some elements that are inside of this filter like the hr (horizontal rule) when there's a filter applied and there are no matches, probably via CSS.

something like .tablefilter:empty(){ hr class-name {display : none;}}

Katerina Kovriga _Stiltsoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2021

We often use CSS to hide specific items from the Table Filter menu. Here is an example of several expressions to hide the "Hide columns" option for the different variants of the macro usage.

What exactly do you need to do? Do you use a filtering panel and when there are no any results you want to hide it? So your colleagues won't see it and won't know about the applied filters?

Ulrik Schoth
Contributor
January 16, 2025

Hi @Katerina Kovriga _Stiltsoft_ 

I hope you're still listening to this posting... ;-)

I was looking for a solution to avoid the display of the empty table header row if the filter conditions are set too restrictive. I found your solution, to wrap the Table Filter macro with a Table Transformer macro and it's a great solution. BUT:

Now the table filters are no longer displayed above the table, but below it.

This is also visible in your example (see screenshot). Since my table is rather long, this is not an acceptable solution. How can this be avoided?

Regards
Ulrik

table-filter-below-table.png

Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2025

Seems that is all we can suggest. Originally, the table header is supposed to be always visible.

Maybe in you case it's better to switch to the filters in headers instead of the filtration panel: you'll get just a header with compact filter icons if there are no any suitable rows. 

Ulrik Schoth
Contributor
January 16, 2025

Thank you very much for your quick reply. I already had this idea. Unfortunately, it does not work:

The filters in the header rows are not displayed if the Table Filter Macro is wrapped by a Table Transformer Macro.

Table Filter Macro without Table Transformer Macro:

header-filter-without-table-transformer-macro.png

 

Table Filter Macro wrapped by Table Transformer Macro:

header-filter-with-table-transformer-macro.png

Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2025

Firstly, why do you need the Table Transformer macro if you switched to the filters in headers?

Secondly, for me the filters in the headers work as they are supposed inside the Table Transformer macro.

Ulrik Schoth
Contributor
January 16, 2025

I'll try to clarify what I mean. BTW: We are using your Table Filter app V12.0.3 and Confluence 8.5.18 DC.

This is my use case:

If the user selects filters from the filtration panel that do not give any results, the normal behaviour of the Table Filter macro is that only the table header row is displayed.

To my experience this irritates users. I'd prefer a displayed message. Unfortunately it is currently not possible to configure this in the Table Filter macro.

An additional option like in the screenshot below would be a solution:wanted-solution.png

 

WORKAROUND

According to Katerina a wrapping Table Transformer macro creates such a message if the table is empty. This workaround is OK but unfortunately the filtration panel is no longer displayed on top of the table but at the bottom. Which makes the workaround unusable for us.

Edit mode

edit-view.png

Current: View mode when table is empty

table-empty.png

Current: View mode when table is not empty

table-not-empty.png

I just wanted to know if there is a trick for the workaround to show the filtration panel above the table.

 

 

Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2025

As we've mentioned before, the workaround with the Table Transformer macro is just a workaround, so it works as it works.

The table headers are not supposed to be hidden initially. So, if your users don't want to see both the filtration panel and the table header, you may switch to the filters in the headers and your users will see only the table header with tiny filter icons.

Ulrik Schoth
Contributor
January 16, 2025

My users and I have no problem at all with the Filtration panel. On the contrary, the panel is often used to filter the table. Therefore, it should of course be visible.

However, entering filter conditions is very cumbersome if the filtration panel is below the table and not above of it. At least if the table is very long. And imho, a filter option is usually expected above a table.

I have understood that the workaround with the Table Transformer Macro - which is only used to display a hint instead of an empty table if the filter conditions are too restrictive - obviously does not offer this possibility.

Thanks very much for this explanation.

Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2025

Maybe we weren't clear about the workaround:

Screenshot 2025-01-16 at 20.17.22.png

Here is a screenshot taken when we choose to Show all content in the Table Transformer macro.

The header is your original table when the filters are too strict and there are no any rows. It comes from the Table Filter macro.

The filtration panel comes with the original table and also belongs to the Table Filter macro.

The blue message is an output of the Table Transformer macro. And the output of the external macro is always on top.

If the filters are not strict, we will have the same view but with the whole table:

Screenshot 2025-01-16 at 20.22.06.png

By choosing the Hide tables option in the Table Transformer macro we hide the original table coming from the Table Filter macro (and it is the second lower table!).

So, on top we have the table coming from the Table Transformer macro. Below it we still have the filtration panel from the Table Filter macro.

The filtration panel remains until we choose the Hide all content option.

Like Ulrik Schoth likes this
Ulrik Schoth
Contributor
January 17, 2025

Thank you for the detailed explanation of how it works. I hadn't actually thought about the Source data option. This was set to "Hide tables" (apparently the default value).

So the table that is displayed with this setting is the output of the Table Transformer macro. This was not clear to me and of course explains why the filtration panel is displayed below the table. And also why filters in header were not displayed in my case.

Unfortunately, this doesn't help me for my use case. But now I can at least understand what is happening. Thanks again for your help.

Like Stiltsoft support likes this
Stiltsoft support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 20, 2025

Hi @Ulrik Schoth ,

The following structure may help to keep the filtration panel above the table:

screenshot-2.png

It seems to be rather overloaded though, so we've created a feature request for our internal roadmap - this ticket is linked to it, so we'll come back here with the updates when it's implemented.

Like Ulrik Schoth likes this
Ulrik Schoth
Contributor
January 21, 2025

Many thanks for the new workaround. This produces exactly the display I had in mind. But to be honest, I would prefer a simpler solution and would therefore be happy to have a corresponding option directly in the Table Filter macro.

FYI, in case you haven't already noticed: I had started a feature request on this topic after my last reply (TFCS-6190).

Like Stiltsoft support likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events