I have the following function:
(function ($) {
$.fn.createCommonDialog = function () {
this.dialog({
autoOpen: false,
modal: true,
resizable: false,
draggable: true,
height: 'auto',
width: 875,
buttons: {
"Submit": function () {
tinyMCE.triggerSave();
$("#update-message").html('');
$("#menuForm").submit();
},
"Cancel": function () {
$(this).dialog("close");
}
},
open: function (event, ui) {
tinyMCE.init(window.tinyMCEOptions);
$('.ui-dialog-buttonpane').
find('button:contains("Submit")').button({ icons: { primary: 'ui-icon-plus'} });
$('.ui-dialog-buttonpane').
find('button:contains("Cancel")').button({ icons: { primary: 'ui-icon-cancel'} });
$("#dialog_type").wijdropdown();
$("#dialog_select").wijdropdown();
$(":input[type='text'],:input[type='password'],textarea").wijtextbox();
}
});
};
})(jQuery);
I create the dialog in one part of the code:
$('#commonDialog').createCommonDialog();
later I call the open event:
var dialogDiv = $('#commonDialog');
dialogDiv.dialog('option', 'title', 'Editing: ' + viewID);
dialogDiv.dialog('open');
Is there some way I can pass a parameter as part of the open call?
Alternatively could I check the value of the ‘title’ option from within the open event?
You could just assign your parameters to a data object and store the data on the element that the plugin is invoked on (
this). Then you can access that inside the open function.