def() field in the editor.dependent
def() field in the editor.dependent

Hi allan, i need def a field in the selection (depend), in the example :
ditor.dependent( 'users.site', function ( val, data, callback ) {
return val === '2' ? // London
{ hide: 'users.phone' } :
{ show: 'users.phone' };
} );
i need load val . I was thinking of something like this
ditor.dependent( 'users.site', function ( val, data, callback ) {
return val === '2' ? // London
{ hide: {label :'users.phone', def:"123123" } :
{ show: {label: 'users.phone' def:"" };
} );
in my editor is:
editor = new $.fn.dataTable.Editor( {
table: "#example",
ajax:"include/implent.php",
fields: [
{label: "phone", name: "user.phone"},
.
.
.
This discussion has been closed.
Answers
Is setting the default really that useful in a
dependent()
callback? It wouldn't be applied to the field until the next time an edit is performed (since it will already have a value at that point), but perhaps that is what you want?Allan