CreateTemplate、OpenTemplate、およびその他の多くの Jquery ダイアログの設定では、ほとんど同じ設定が使用されますが、高さと幅には例外があります。
すべてのキー/値設定を含む配列の jquery .dialog() 関数ソートを渡すことは可能ですか?この配列をいつでも簡単に渡すことができますか?
$(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"); }
}
});
});
});