Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to dynamicaly show/hide columns with JS based on current month?

Faaiz QadriFeb 21 2022

Hello,
I have a table with month names as columns and each month I would like to show and hide specific columns dynamically without manually changing the application each month. For e.g, if it is February now, I want to hide the column named 'January' and show the column 'February' till 'December'. When March starts, the JS function should hide February and show from March column onwards.
Right now I am doing something like this in 'Attributes -> JS Initialisation Code':
const d = new Date();
let month = d.getMonth();

if (month === 1) {
gridView.view$.grid("hideColumn", "JANUARY");}
else {
gridView.view$.grid("showColumn", "FEBRUARY");}

However, this is not working at all. Any sort of help will be appreciated.

This post has been answered by Hamza Al-abbasi on Feb 21 2022
Jump to Answer

Comments

Post Details

Added on Feb 21 2022
9 comments
9,228 views