DT Editor defaults

DT Editor defaults

tangerinetangerine Posts: 3,350Questions: 37Answers: 394

Description of problem:
I want to use autocomplete: "off" on all my "Create" forms. I've tried various permutations of this:

$.extend( true, $.fn.dataTable.Editor.defaults, {
     create: {
        autocomplete: "off"
    },  
    formOptions: {
        main: {
            onBackground: 'none' // Do not close form on click outside.
        }
    } 

} )

Is it even possible to apply this attribute globally?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    See if this thread helps.

    Kevin

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Hi Kevin. I had tried the "attr" option, with no success, and now using this exact code from the thread you gave me

    $.extend( true, $.fn.dataTable.Editor.Field.defaults, {
      attr: {
        autocomplete: 'off'
      }
    } );
    

    it's not working. No discernible errors, and I can't think of anything which might be interfering.
    Weird.

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    I put your code snippet in this example and it works.
    https://live.datatables.net/guwafemu/404/edit

    Make sure it executes before you initialize the Editor.

    Kevin

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Neither of us noticed that I had

    $.extend( true, $.fn.dataTable.Editor.defaults, {
    

    where I needed

    $.extend( true, $.fn.dataTable.Editor.Field.defaults, {
    

    All okay now. I appreciate your help.

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    That's a good point - I should document where the defaults are. Thanks!

    Allan

Sign In or Register to comment.