Hi,
Running a Plumsail form on a SharePoint SP2019 farm onprem.
The Plumsail form opens on the classic view, in a dialog.
Is it possible to resize the Plumsail dialog box?
I can check if the form is open in a dialog with
fd.spRendered(function () {
console.log('*** fd.spRendered ***');
if (fd.isDialog){
console.log("fd.isDialog");
}
});
Is is possible to make size 90% of the width and heigth of the parent window?
kind regards,
bartplessers
Margo
(Margo)
2
Hello @bartplessers,
You can use this code to change the dialog window size:
fd.spRendered(function(){
setTimeout(function(){
//adjust size as needed
window.top.document.getElementsByClassName('ms-dlgBorder')[0].style.height = '100%';
window.top.document.getElementsByClassName('ms-dlgFrame')[0].style.height = '100%';
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.height = '100%';
window.top.document.getElementsByClassName('ms-dlgFrameContainer')[0].style.height = '100%';
}, 100);
});
Nice one! Thanx.
One more question: with
setTimeout(function () {
//adjust size as needed
window.top.document.getElementsByClassName('ms-dlgBorder')[0].style.height = '95%';
window.top.document.getElementsByClassName('ms-dlgFrame')[0].style.height = '95%';
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.height = '95%';
window.top.document.getElementsByClassName('ms-dlgFrameContainer')[0].style.height = '95%';
window.top.document.getElementsByClassName('ms-dlgBorder')[0].style.width = '95%';
window.top.document.getElementsByClassName('ms-dlgFrame')[0].style.width = '95%';
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.width = '95%';
window.top.document.getElementsByClassName('ms-dlgFrameContainer')[0].style.width = '95%';
}, 100);
the dialog has it size, but it starts rendering in the "middle" of the browser window before it is resized, resulting in:
Do you have some magic to reposition the dialog to the center of the browser window?
kind regards,
bartplessers
Hi,
This seems satisfying....
if (fd.isDialog) {
console.log("fd.isDialog");
setTimeout(function () {
//adjust size as needed
let width = window.parent.innerWidth;
let height = window.parent.innerHeight;
//console.log(width);
//console.log(height);
window.top.document.getElementsByClassName('ms-dlgFrameContainer')[0].style.width = (width - 50).toString() + "px";
window.top.document.getElementsByClassName('ms-dlgFrame')[0].style.width = '100%';
window.top.document.getElementsByClassName('ms-dlgFrame')[0].style.height = (height - 100).toString() + "px";
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.width = (width - 10).toString() + "px";
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.height = (height - 10).toString() + "px";
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.left = '5px';
window.top.document.getElementsByClassName('ms-dlgContent')[0].style.top = '5px';
window.top.document.getElementsByClassName('ms-dlgBorder')[0].style.width = (width - 20).toString() + "px";
}, 100);
}