Global settings in makeEditable
Global settings in makeEditable
hello,
is there a way to define f.e. onblur and submit globally inside makeEditable instead of repeating it in every aoColumns-section?
how could the following code be changed to avoid repeating the identical options?
[code]
$(document).ready( function () {
$('#example').dataTable().makeEditable({
sUpdateURL: "UpdateData.php",
"aoColumns": [
null,
{
},
{
indicator: 'Saving Browser...',
tooltip: 'Click to edit browsers',
type: 'textarea',
onblur: 'cancel',
submit:'Save changes',
fnOnCellUpdated: function(sStatus, sValue, settings){
alert("(Cell Callback): Cell is updated with value " + sValue);
}
},
{
indicator: 'Saving platforms...',
tooltip: 'Click to edit platforms',
type: 'textarea',
onblur: 'cancel',
submit:'Save changes',
fnOnCellUpdated: function(sStatus, sValue, settings){
alert("(Cell Callback): Cell is updated with value " + sValue);
}
}
]
});
})
[/code]
regards
arnim
is there a way to define f.e. onblur and submit globally inside makeEditable instead of repeating it in every aoColumns-section?
how could the following code be changed to avoid repeating the identical options?
[code]
$(document).ready( function () {
$('#example').dataTable().makeEditable({
sUpdateURL: "UpdateData.php",
"aoColumns": [
null,
{
},
{
indicator: 'Saving Browser...',
tooltip: 'Click to edit browsers',
type: 'textarea',
onblur: 'cancel',
submit:'Save changes',
fnOnCellUpdated: function(sStatus, sValue, settings){
alert("(Cell Callback): Cell is updated with value " + sValue);
}
},
{
indicator: 'Saving platforms...',
tooltip: 'Click to edit platforms',
type: 'textarea',
onblur: 'cancel',
submit:'Save changes',
fnOnCellUpdated: function(sStatus, sValue, settings){
alert("(Cell Callback): Cell is updated with value " + sValue);
}
}
]
});
})
[/code]
regards
arnim
This discussion has been closed.
Replies
see http://api.jquery.com/jQuery.extend/
[code]
$(document).ready( function () {
// this is the global default
defaultEditable = {
tooltip: 'Click to edit browsers',
type: 'textarea',
onblur: 'cancel',
submit:'Save changes',
fnOnCellUpdated: function(sStatus, sValue, settings){
alert("(Cell Callback): Cell is updated with value " + sValue);
};
};
$('#example').dataTable().makeEditable({
sUpdateURL: "UpdateData.php",
"aoColumns": [
null,
{ },
$.extend({ }, defaultEditable, { indicator: 'Saving Browser...' }),
$.extend({ }, defaultEditable, { indicator: 'Saving Platform...' }),
]
});
});
[/code]
this works great, thanks a lot! it even overwrites settings from defaultEditable if they're set again in aoColumns.