Sheik Posted December 8, 2017 Report Share Posted December 8, 2017 i have a search page where i am searching using a view and i would like to hide columns that are totally empty Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 5, 2018 Report Share Posted January 5, 2018 If you have a list or gallery you can check to hide if the value is blank but to hide the whole column if there is no data in the entire column in a tabular report I could not find any standard way to do it Quote Link to comment Share on other sites More sharing options...
cheonsa Posted February 5, 2019 Report Share Posted February 5, 2019 Hi @Sheik, I found a similar post about hiding columns if empty. You may check this for reference: Hope this helps. Regards, kristina Quote Link to comment Share on other sites More sharing options...
Kurumi Posted January 7, 2022 Report Share Posted January 7, 2022 Quote Link to comment Share on other sites More sharing options...
futurist Posted April 20, 2022 Report Share Posted April 20, 2022 Hi @Sheik Yes, this can be achieved using JavaScript.On your DataPage, go to Configure Results Page Fields. Add a Header and Footer, and the following on the Footer: <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { var claimnumbers = document.querySelectorAll("table tr td:nth-child(1)"); var numOfEmpty = 0; [].forEach.call(claimnumbers, function(elem, i) { if(elem.innerHTML != " "){ numOfEmpty = 1; } }); if(numOfEmpty != 1){ var header = document.querySelector("table tr th:nth-child(1)"); var cells = document.querySelectorAll("table tr td:nth-child(1)"); header.style.display = "none"; [].forEach.call(cells, function(cell, i) { cell.style.display = "none"; }); } }); </script> Wherein the 1 the "nth-child" occurences refer to the column to look out for. Change this value according to which order the column you need to apply this to come in. Sample DP: https://c1hch576.caspio.com/dp/db26a0005d70567a6b3c43dab5cf where Account Number 4356 has records with no claim numbers, so Claim Number column gets hidden Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.