If I want to create a jQuery UI dialog box, I use something like:
var settings = {autoOpen:false, draggable:false, and so on...};
var dialog = $("#container").dialog(settings);
But now I want to know how I can get the dialogue settings as shown above, something like
dialog.getSettings();
I need this because I have an application that uses a lot of dialogs with default behavior. Sort of
function doAfterSubmit(dialogSettings) {
}
var dialogSettings = {
user:{
add:{
title:"Add user",
buttons:{
"Add":function() {
var settings = $(this).getSettings();
doAfterSubmit(settings);
}
},
otherProperties
},
remove:{
title:"Remove user",
buttons:{
"Remove":function() {
var settings = $(this).getSettings();
doAfterSubmit(settings);
}
},
otherProperties
},
removeAll:{
title:"Remove all user",
buttons:{
"Remove all":function() {
var settings = $(this).getSettings();
doAfterSubmit(settings);
}
},
otherProperties
}
}
}
After looking at the source of the jQuery UI dialog, I noticed a property called defaults that contains all the properties of the dialog component. But how can I get this property by default ?
Yours faithfully,
source
share