Glitch Posted July 23, 2019 Report Share Posted July 23, 2019 Hi there, I am creating a Calendar DataPage. I want highlight the days that have passed prior to today's date. Something like this. Is this possible? Thanks. Quote Link to comment Share on other sites More sharing options...
0 DefinitelyNot31337 Posted July 23, 2019 Report Share Posted July 23, 2019 Hello @Glitch You may try pasting this code in the Footer section of "Configure Fields for Calendar" of your DataPage Configuration. Do make sure that HTML Editor is Disabled from the Advanced Tab. <script> var curr = document.querySelector('.cbResultSetCalendarTableNowCell .cbResultSetCalendarField') var dates = document.querySelectorAll('[class*=cbResultSetCalendarField') for (let [idx, elem] of dates.entries()) { if (elem == curr) break; elem.parentNode.style.background = "red"; } </script> Hope this helps. DN31337! Glitch 1 Quote Link to comment Share on other sites More sharing options...
0 Glitch Posted July 23, 2019 Author Report Share Posted July 23, 2019 Awesomesauce. Thanks @DefinitelyNot31337! DefinitelyNot31337 1 Quote Link to comment Share on other sites More sharing options...
0 TroubleShooter Posted July 23, 2019 Report Share Posted July 23, 2019 Hi! This works. However, when I scroll go over to the previous and next months, the highlighting seems to go out. Is there something we can do to prevent the highlight from being removed? Quote Link to comment Share on other sites More sharing options...
0 DefinitelyNot31337 Posted July 24, 2019 Report Share Posted July 24, 2019 Hello @TroubleShooter, You may try using this updated code below: <script> document.addEventListener('DataPageReady', function() { var curr = document.querySelector('.cbResultSetCalendarTableNowCell .cbResultSetCalendarField') var dates = document.querySelectorAll('[class*=cbResultSetCalendarField') for (let [idx, elem] of dates.entries()) { if ( !curr || elem == curr) break; elem.parentNode.style.background = "red"; } }) </script> This, however only highlights the previous days of the current month you're in. Quote Link to comment Share on other sites More sharing options...
Question
Glitch
Hi there,
I am creating a Calendar DataPage.
I want highlight the days that have passed prior to today's date.
Something like this.
Is this possible?
Thanks.
Link to comment
Share on other sites
4 answers to this question
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.