Only show toggler in case there is data

Only show toggler in case there is data

sim24sim24 Posts: 6Questions: 3Answers: 0

Link to test case: https://jsfiddle.net/6mkj0874/

Description of problem: I have a responsibe table with optional fields, meaning that some TD will be empty. I would like to only display the collapse toggle when there is data to show (1st row in the example), but hide it in case there is no data to display (2nd row in the example) Is there an obvious way to do that ?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    That's not possible, I'm afraid, the '+' will always be shown. You could modify the responsive.details.renderer to not show that data, that's easily done, but the collapse toggle would always be visible.

    One option perhaps would be to always display the hidden data, but using the method above to not display those empty columns. In this example, it's doing something similar, not displaying with "London" in the office column,

    Colin

  • allanallan Posts: 61,443Questions: 1Answers: 10,053 Site admin
    Answer ✓

    @Larisabrownb - I presume this is GPT generated text, because it reads like a mash up of questions and answers? Link removed as it doesn't link to a test case.

    Allan

  • sim24sim24 Posts: 6Questions: 3Answers: 0

    I found a hacky way to do it : Going through the table and checking whether each element has a child or not, and if not, hide the '+' via CSS. Imperfect, but does the trick.

    Illustrated here :
    https://jsfiddle.net/02hmraz9/

Sign In or Register to comment.