CreateTemplate, OpenTemplate and many other Jquery dialog setups use most time the same settings but there are exceptions for the height and width.
Is it possible to pass the jquery .dialog() function sort of an array with all key/value settings so I can easily always pass this array?
$(document).ready(function () {
// I would like to setup here sort of an array with properties and values
// as basis for each click-handler
/************************* Open template ****************************/
$('#OpenTemplate').click(function (e) {
e.preventDefault();
var link = this;
$('#MyDialog').dialog({
open: function (e) { $(this).load($(link).attr('href')); },
title: link.innerHTML,
autoOpen: true,
modal: true,
show: 'fade',
hide: 'fade',
width: 250,
height: 200,
buttons:
{
"OK": function () { openTemplate($(this), $('form', this)); },
"Cancel": function () { $(this).dialog("close"); }
}
});
});
/************************* Create template ****************************/
$('#CreateTemplate').click(function (e) {
e.preventDefault();
var link = this;
$('#MyDialog').dialog({
open: function (e) { $(this).load($(link).attr('href')); },
title: link.innerHTML,
autoOpen: true,
modal: true,
show: 'fade',
hide: 'fade',
width: 250,
height: 200,
buttons:
{
"OK": function () { createTemplate($(this), $('form', this)); },
"Cancel": function () { $(this).dialog("close"); }
}
});
});
});