def() field in the editor.dependent

def() field in the editor.dependent

asassaasassa Posts: 4Questions: 3Answers: 0
edited March 2015 in Free community support

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"},
.
.
.

Answers

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    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

This discussion has been closed.