Jump to content
  • 0

Hide Calendar Column By Condition



3 answers to this question

Recommended Posts

  • 0

Hello @IVAN88,

In my opinion, the easiest way is to use Calculated Field instead of the Notes field. 

For example:

CASE WHEN [@field:Room] < 10
THEN [@field:Notes]

So, when the condition to display the field is met the field is displayed, if not - the field is empty.

Then JavaScript can hide the label of the Calculated Field when it is empty.

document.addEventListener('DataPageReady', hideFieldHandler);
function hideFieldHandler() {
    const calcFields = document.querySelectorAll('dl dd:nth-of-type(2)'); //2 is the position of the Calculated field
    const calcLabels = document.querySelectorAll('dl dt:nth-of-type(2)'); //2 is the position of the Calculated field

    calcFields.forEach((field, index) => {
        if(field.innerHTML == "&nbsp;"){
            calcLabels[index].style.display = 'none';

In this example, the Calculated field is the second field on the Calendar page, so I reference it as 'nth-of-type(2)'. The digit should be replaced according to your page layout.



Feel free to update the thread if you have further questions. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...