admin管理员组文章数量:1025227
I need to excute a generic function (console.log) on closing (on hide) modal window created with this javascript code:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
).on('hide', function() {
console.log("Modal closed")});
});
});
'url' and 'title' are two variables passing from code above.
It doesn't work.
Any suggestion?
I need to excute a generic function (console.log) on closing (on hide) modal window created with this javascript code:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
).on('hide', function() {
console.log("Modal closed")});
});
});
'url' and 'title' are two variables passing from code above.
It doesn't work.
Any suggestion?
- is "hide" definitly the name of the event that close s the window? – JF it Commented Mar 18, 2014 at 17:58
3 Answers
Reset to default 3This will not work until you set destroyOnHide dialog option to true.
By default it is set to false, hence the popup will only be hidden.
See below:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow({
title : title,
uri: url,
dialog: {
destroyOnHide: true,
cache: false,
modal: true
}
}).after('destroy', function(event) {
alert('DESTROY MODAL!');
});
});
});
Then you will be able to intercept destroy event with after() method as usual.
Hi replace your on('hide'
with this:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
) on: {
close: function(event) {
console.log("Modal closed")});
});
});
The right event called on dialog close is destroy
event.
Liferay Window
extends A.Component
which has destroy
event. In fact to close a Window the right way is to call desploy()
method.
AUI().ready(function(A) {
AUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
).after('destroy', function() {
console.log("Modal closed");
});
});
});
I need to excute a generic function (console.log) on closing (on hide) modal window created with this javascript code:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
).on('hide', function() {
console.log("Modal closed")});
});
});
'url' and 'title' are two variables passing from code above.
It doesn't work.
Any suggestion?
I need to excute a generic function (console.log) on closing (on hide) modal window created with this javascript code:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
).on('hide', function() {
console.log("Modal closed")});
});
});
'url' and 'title' are two variables passing from code above.
It doesn't work.
Any suggestion?
- is "hide" definitly the name of the event that close s the window? – JF it Commented Mar 18, 2014 at 17:58
3 Answers
Reset to default 3This will not work until you set destroyOnHide dialog option to true.
By default it is set to false, hence the popup will only be hidden.
See below:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow({
title : title,
uri: url,
dialog: {
destroyOnHide: true,
cache: false,
modal: true
}
}).after('destroy', function(event) {
alert('DESTROY MODAL!');
});
});
});
Then you will be able to intercept destroy event with after() method as usual.
Hi replace your on('hide'
with this:
YUI().ready(function(A) {
YUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
) on: {
close: function(event) {
console.log("Modal closed")});
});
});
The right event called on dialog close is destroy
event.
Liferay Window
extends A.Component
which has destroy
event. In fact to close a Window the right way is to call desploy()
method.
AUI().ready(function(A) {
AUI().use('aui-base','liferay-util-window', function(A) {
Liferay.Util.Window.getWindow(
{
title : title,
uri: url,
dialog: {
cache: false,
modal: true
}
}
).after('destroy', function() {
console.log("Modal closed");
});
});
});
本文标签: javascriptLiferay 62 modal add callback on closeStack Overflow
版权声明:本文标题:javascript - Liferay 6.2 modal add callback on close - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745575723a2157006.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论