cancel
Showing results for 
Search instead for 
Did you mean: 
Grill Chef sfychan
Grill Chef

Can a table in Smart Doc to be disappeared / hidden by condition - IF

I have couple tables made in a output doc. I would like to see if one of the table can be disappear if there is no entry of a value.

Any suggestion?

Message 1 of 5
0 Likes
4 Replies
Highlighted
Sushi Chef cpalmer
Sushi Chef

Re: Can a table in Smart Doc to be disappeared / hidden by condition - IF

I think you can do this via CSS. I am actually just about to try this as well for a discount column in a table and if there is no row data for this column I am going to try and hide the whole column. 

~If my post was useful, please give me a thumbs up! Mark correct answers as 'solutions' so we can all find answers faster!~
Message 2 of 5
Pastry Chef acooper
Pastry Chef

Re: Can a table in Smart Doc to be disappeared / hidden by condition - IF

Hi, we achieve this by using CSS and javascript within the service report source code. Here are two snippets from our page:

1. First is the section to show or hide based on a field value:

2. Then at the bottom of the page we have this javascript function to read  the field value and decide whether to show the section or not:

( function() { var ret = document.getElementById('nen-test-NOT-performed'); if($D.Work_Order.NEN_Test_Performed__c == "NO" ) ret.style.display='block'; else ret.style.display='none'; }

Hope that helps!

Adam.

Message 3 of 5
Grill Chef sfychan
Grill Chef

Re: Can a table in Smart Doc to be disappeared / hidden by condition - IF

Hello Adam,

I'd like to learn few techniques from you suggestion as I am not familiar with Javascript if I may. Will your code with Javascript enable to hide the section and make room for the rest of content to move up to the section? Or will it leave space of the section? Ultimately I am looking for the section disappeared when there is no value and allow any following content to move up or occupy the space.

Secondly, where exactly the javascript to be put or entered in the Source of Smart docs. You said it is at the bottom of the page ( Is it end of the source?). Any reference material would you refer me to read about putting Javascript in CSS of Smart Docs?

Thanks,

Simon

Message 4 of 5
0 Likes
Pastry Chef acooper
Pastry Chef

Re: Can a table in Smart Doc to be disappeared / hidden by condition - IF

Hi Simon,

Yes, if the section is hidden, the rest of the content moves up and fills the gap left by the hidden section so it should do exactly what you require.

The javascript is added at the end of the page after the last </div>.

Let us know how you get on

Adam.

Message 5 of 5
0 Likes