[jQuery] jqModal Trigger
[jQuery] jqModal Trigger
I have a question regarding the jqModal trigger. I'm writing in a
portal environment, which makes things a little more complicated. I
am opening a modal dialog using a link in a portlet, but I'd like to
update the portlet via ajax after a form in the dialog is submitted.
In order for me to update the portlet via ajax, I need to access the
trigger so that I can determine which portlet it was. For some reason
the following code is not working. The trigger is undefined in the
open and close functions.
Can anyone identify what I might be doing wrong?
jQuery(".openDialog")
.livequery("click", function () {
var theUrl = jQuery(this).attr("href");
var jqmTrigger = jQuery(this);
jQuery("#vcuDialog").jqm({ ajax: theUrl, modal: true,
onShow: open, onLoad: load, onHide: close })
.jqmAddTrigger(jqmTrigger)
.jqmShow();
return false;
});
jQuery(".closeDialog")
.livequery("click", function () {
jQuery("#vcuDialog").jqmHide();
return false;
});
var open = function(hash) {
alert(hash.t); // shows 'undefined'
hash.w.css('opacity',0.88).show();
};
var close = function(hash) {
hash.w.fadeOut('2000', function(){
alert(hash.t); // shows 'undefined'
hash.o.remove();
});
};
var load=function(hash){ $
('form',this).ajaxForm(); };
...
// link on the portlet
<a href="${addURL}" class=openDialog>Add Link</a>
...
// link in the dialog
<a href="#" class="closeDialog">Close Me</a>
...
<div id="vcuDialog" class="jqmWindow">
<!-- used for the jqModal jQuery plugin -->
</div>
Thanks!