留言板

Trigger event on closing modal box

Harsh Kanakhara,修改在6 年前。

Trigger event on closing modal box

Junior Member 帖子: 74 加入日期: 17-4-6 最近的帖子
While creating blogs I am selecting categories from the modal box. When closing modal box I want to trigger event. I like to add Alloy-UI close event for that categories selector modal box but it is generated using liferay-ui taglib.


<liferay-ui:panel defaultstate="closed" extended="<%= false %>" id="blogsEntryCategorizationPanel" persiststate="<%= true %>" title="categorization">
		<aui:fieldset>
			<aui:input name="categories" type="assetCategories" />
			<aui:input name="tags" type="assetTags" />
		</aui:fieldset>
</liferay-ui:panel>


Code for binding close event on alloy-ui modal box.


modalObject.on('visibleChange', function(event) {
        if (!event.newVal) {
            alert('user closed the window');
        }
});


How can I get modal object in script for categories selector modal box to bind close event on it ?

Regards,
Harsh Kanakhara.
tran nam dinh,修改在6 年前。

R: Trigger event on closing modal box

New Member 帖子: 2 加入日期: 15-3-14 最近的帖子
I always used javascript to open a jsppage in AUI modal and I can bind event modal close (and more communicate between modal and opener).
You can try this tutorial http://www.liferaysavvy.com/2014/06/liferay-62-aui-dialog-liferay-popup.html?m=1

Sent from my iPhone with Liferay.com Forums
Harsh Kanakhara,修改在6 年前。

RE: R: Trigger event on closing modal box

Junior Member 帖子: 74 加入日期: 17-4-6 最近的帖子
Thanks for your response.

For the custom portlet I can use the same thing but the Liferay core modules how can I do that ? I am doing changes in the jsp hook for blog page. Modal Box is generated by Liferay Tag lib. So I am confused how to get modal object for that specific aui-modal ?

Currently I have set interval to check for the modal box to close and it is working fine but it is the not the proper way to it.

Please can you provide the code snippets of what you are trying to say.

Regards,
Harsh Kanakhara.
thumbnail
Ketan Savaliya,修改在6 年前。

RE: R: Trigger event on closing modal box

Regular Member 帖子: 117 加入日期: 11-3-3 最近的帖子
Harsh Kanakhara:
Thanks for your response.

For the custom portlet I can use the same thing but the Liferay core modules how can I do that ? I am doing changes in the jsp hook for blog page. Modal Box is generated by Liferay Tag lib. So I am confused how to get modal object for that specific aui-modal ?

Currently I have set interval to check for the modal box to close and it is working fine but it is the not the proper way to it.

Please can you provide the code snippets of what you are trying to say.

Regards,
Harsh Kanakhara.


Hi Harsh,

You can update that jsp to handle close even if it's OOTB functionality.

HTH!!

Regards,
Ketan Savaliya
Harsh Kanakhara,修改在6 年前。

RE: R: Trigger event on closing modal box

Junior Member 帖子: 74 加入日期: 17-4-6 最近的帖子
Thanks for your response. Yes I can handle Modal Box close event in my jsp. But my concern is Modal Box is generated using liferay:panel tag, not in my hook jsp. So how can I get the modal object for that specific modal box ?

If you can provide code snippet then it would be much helpful. emoticon

Regards,
Harsh Kanakhara.