Connonymous Posted March 23 Report Share Posted March 23 I have a tabular report that has 30 columns. Some users only use 10, 12, 15, etc. of the columns, whereas others use all 30. Has anyone come across a good way to dynamically hide the columns that have no data for that user? Or even better, for that particular search/filter? One additional caveat, I would like the DataPage to be downloadable, so if possible I would like to try to avoid something that uses hidden calculated fields in the columns, because then when downloaded, those columns would be downloaded as well. Thank you in advance for any help or ideas. Please let me know if any additional information is needed! Quote Link to comment Share on other sites More sharing options...
cheonsa Posted March 25 Report Share Posted March 25 Hi @Connonymous, You may refer to these posts to hide columns if blank: Quote Link to comment Share on other sites More sharing options...
Connonymous Posted March 26 Author Report Share Posted March 26 @cheonsa Those sections don't seem to be working for me. I did figure out a temporary workaround using JavaScript, but it doesn't seem like the optimal way to handle cases. I added a field to my Authentication table that specifies the number of columns the table needs to have. Then I reference it in the footer with this code. This doesn't handle cases where I search and a smaller subset is returned, but it does at least handle cases where all columns are blank for that user all the time. Any additional ideas on how I might be able to better handle these cases? <script> document.addEventListener('DataPageReady', function (event) { let table = document.querySelector('table[data-cb-name="cbTable"]'); if (table) { while (table.querySelector('tr').children.length >= [@authfield:Hide_Ref]) { let label = table.querySelector('th:nth-of-type([@authfield:Hide_Ref])'); let values = table.querySelectorAll('td:nth-of-type([@authfield:Hide_Ref])'); if (label) label.parentElement.removeChild(label); values.forEach(el => { if (el) el.parentElement.removeChild(el); }); } } }); </script> 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.