Forum Discussion

wcdghvr's avatar
wcdghvr
Copper Contributor
Dec 02, 2022

How to hide button on PDP Schedule.aspx on Project Tab ribbon?

Hello.

How to hide button on PDP Schedule.aspx on Project Tab ribbon in Project Server 2019?

CustomAction not working.

  • I found solution:
    <script>
    var ribbonIDs = ['Ribbon.Tabs.PDP.Home-title'];

    window.onload = function() {
    ConfigRibbon();
    setTimeout('HideChange()', 500);
    };

    function ConfigRibbon() {
    if (typeof Ribbon !== 'undefined') {
    Ribbon.onloadeddata = function() {
    for (var i = 0; i < ribbonIDs.length; i++) {
    if (ExpandRibbon(ribbonIDs[i])) {
    break;
    }
    }
    }
    for (var i = 0; i < ribbonIDs.length; i++) {
    if (ExpandRibbon(ribbonIDs[i])) {
    break;
    }
    }
    } else setTimeout('ConfigRibbon()', 100);
    }


    function HideChange() {
    var el = document.getElementById('Ribbon.Tabs.PDP.Home.Project.Edit-Large');
    if (el) {
    el.style.display = 'none';
    }
    return true;
    }

    function ExpandRibbon(id) {
    var el = document.getElementById(id);
    if (el) {
    var event = document.createEvent("MouseEvents");

    event.initEvent("click", true, true);
    event.synthetic = true;

    el.childNodes[0].dispatchEvent(event, true);
    return true;
    }
    return false;
    }
    &lt;/script&gt;
  • wcdghvr's avatar
    wcdghvr
    Copper Contributor
    I found solution:
    &lt;script&gt;
    var ribbonIDs = ['Ribbon.Tabs.PDP.Home-title'];

    window.onload = function() {
    ConfigRibbon();
    setTimeout('HideChange()', 500);
    };

    function ConfigRibbon() {
    if (typeof Ribbon !== 'undefined') {
    Ribbon.onloadeddata = function() {
    for (var i = 0; i < ribbonIDs.length; i++) {
    if (ExpandRibbon(ribbonIDs[i])) {
    break;
    }
    }
    }
    for (var i = 0; i < ribbonIDs.length; i++) {
    if (ExpandRibbon(ribbonIDs[i])) {
    break;
    }
    }
    } else setTimeout('ConfigRibbon()', 100);
    }


    function HideChange() {
    var el = document.getElementById('Ribbon.Tabs.PDP.Home.Project.Edit-Large');
    if (el) {
    el.style.display = 'none';
    }
    return true;
    }

    function ExpandRibbon(id) {
    var el = document.getElementById(id);
    if (el) {
    var event = document.createEvent("MouseEvents");

    event.initEvent("click", true, true);
    event.synthetic = true;

    el.childNodes[0].dispatchEvent(event, true);
    return true;
    }
    return false;
    }
    &lt;/script&gt;

Resources