Forum Discussion
wcdghvr
Dec 02, 2022Copper Contributor
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;
}
</script>
- wcdghvrCopper ContributorI 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;
}
</script>