scottdurow / RibbonWorkbench

Ribbon Workbench 2016 for Dynamics 365
https://ribbonworkbench.uservoice.com/
MIT License
72 stars 24 forks source link

Open Dialog no longer hides the NavigateTo title bar #65

Open robertbastien opened 3 years ago

robertbastien commented 3 years ago

Hi Scott,

As mention in your documentation for the Open Dialog smart button, if the Title property is empty then the Title bar will not display.

For a few days now, on a Dynamics 365 implementation where I leverage Open Dialog smart button, this has stopped working. Although the Title property on my buttons are all empty, the Title bar is displaying in all circumstances.

I initially suspected that a Dyn365 patch had been deployed to our instance and that something had changed in the NavigateTo function. After looking at the code in Smartbuttons.ClientHooks.js and looking at the HTML output from the smart button, I notice that in the code you refer to defaultDialogChromeHeader (the header displayed by NavigateTo) but that the HTML was generated by the NavigateTo function had a header with an Id = defaultDialogChromeHeader-3 instead of defaultDialogChromeHeader.

image

Tested some more and noticed that the Id for the header will now vary (defaultDialogChromeHeader-1, defaultDialogChromeHeader-2, defaultDialogChromeHeader-3, etc.).

You may need to review the code in the following function:

image

Regards,

Robert Bastien

robertbastien commented 3 years ago

Hi Scott.

Forgot to mention that the same behavior applies to defaultDialogChromeTitle.

Replace getElementById("defaultDialogChromeHeader") by querySelector('[id^="defaultDialogChromeHeader"]')it should do the trick

robertbastien commented 3 years ago

Hi Scott,

I know that I am pushing this a bit but I have noticed that when a smart button is on a form that is opened via NavigateTo its the title bar of the form on which the button resides that disappears instead of the title bar of the dialog.

Here is an example: We dropped a smart button on the Appointment form and when we open an appointment from the Appointment list in the Sales Hub it opens up the appointment as a modal dialog (OTB behavior via NavigateTo). When we click on the smart button on the Appointment form then our dialog appears but its the title bar of the Appointment that disappears.

scottdurow commented 3 years ago

Ok - so I knew this would bite us! There was no supported way to hide or change the title of the dialog originally - now there is a way of changing the title - but not hide.

The next version will allow changing the title but not hiding it because really these kind of DOM changes are very fragile as shown by this.

scottdurow commented 3 years ago

Updated version here - https://github.com/scottdurow/RibbonWorkbench/releases/tag/SmartButtons.v1.2.444.1 If you previously left the title blank it will now show the header but with no title.