Reputation: 19569
I'm trying to configure the width for Alfresco.util.PopupManager.displayPrompt()
but I don't see how to do it.
YUI Dialog has a width property, but the only config that I've managed to see, defaultDisplayPromptConfig
object, doesn't seem to pay much attention to my messing with it.
Specifically, I tried setting Alfresco.util.PopupManager.defaultDisplayPromptConfig.width
but it didn't work :)
I'm also trying to style up the panel I'm loading (create-site style injected panel), but it does not work for now.
Is there a way to configure the PopupManager Prompt object?
TIA
Upvotes: 2
Views: 2925
Reputation: 1572
If you look at the source for Alfresco.util.PopupManager.displayPrompt()
contained in alfresco.js
then you'll see that the method creates an instance of YAHOO.widget.SimpleDialog
, which does support a width property.
The problem is that displayPrompt()
takes only specific configuration options which it passes through to the SimpleDialog
, so adding an additional width
parameter to your config will not have any effect, as you can see.
// Create the SimpleDialog that will display the text
var prompt = new YAHOO.widget.SimpleDialog("prompt",
{
close: c.close,
constraintoviewport: c.constraintoviewport,
draggable: c.draggable,
effect: c.effect,
modal: c.modal,
visible: c.visible,
zIndex: this.zIndex++
});
// Show the title if it exists
if (c.title)
{
prompt.setHeader($html(c.title));
}
// Show the prompt text
prompt.setBody(c.noEscape ? c.text : $html(c.text));
// Show the icon if it exists
if (c.icon)
{
prompt.cfg.setProperty("icon", c.icon);
}
// Add the buttons to the dialog
if (c.buttons)
{
prompt.cfg.queueProperty("buttons", c.buttons);
}
// Add the dialog to the dom, center it and show it.
prompt.render(parent);
prompt.center();
prompt.show();
I like the idea of enhancing the function to support a width
property and possibly others, but in the meantime you are best off using SimpleDialog
directly in your own code, modifying the above to add a width
parameter.
Upvotes: 3