Alfresco.util.PopupManager.displayPrompt not worked properly

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member

Alfresco.util.PopupManager.displayPrompt not worked properly

Hi,

I have used Alfresco.util.PopupManager.displayPrompt() for displaying prompt in alfresco share.

And also I have gave one property which is, close:true in that, but when prompt is coming at that  time close button is working for only first time, then if I click on close button second time then it is not  working,

I have also seen the reference of that prompt in alfresco delete user page, if I will apply close:true in delete user prompt then it is working for that page,

but same thing I have tried in Document -> Actions -> Delete Document , so prompt is coming but close button is working only for the first time like same problem that I am facing in my display prompt.

So, if any YUI or other libraries are there which I got missed or any other reason for that.

Please let me know if anyone has any answer for the same.

Thanks in advance.
                                                                                   

1 Reply
Member II

Re: Alfresco.util.PopupManager.displayPrompt not worked properly

Since this ticket is quite old, I think it's worth enough to answer it. 

You have to create an Alfresco Dialog with your custom logic to close it. The problem is the prompt function in Alfresco.js doesn't return the instance; so you can't create logic for close button. The close button doesn't clean up the listener, hence the dialog doesn't close. 

This is little example: 

var prompt = new YAHOO.widget.SimpleDialog("prompt",

{

close:true,

constraintoviewport: true,

draggable: true,

effect: null,

modal: true,

visible: false,

zIndex: this.zIndex++

});

var buttons= [

{

text : Alfresco.util

.message("your message"),

handler : function DataListActions__onAction_success() {

successFunction();

}

},

{

text : Alfresco.util

.message("button.cancel"),

handler : function DataListActions__onAction_cancel() {

this.destroy();

},

isDefault : true

} ];

prompt.setHeader(Alfresco.util.message("your Header"));

prompt.setBody("");

prompt.cfg.queueProperty("buttons", buttons);

prompt.render( document.body);

prompt.center();

prompt.show();

// remove the default click handler (._doClose)

YAHOO.util.Event.removeListener(prompt.close, "click");

// add a new click handler (._doClose)

YAHOO.util.Event.on(prompt.close, "click", function(){

    this.destroy();

}, prompt, true);