DT Editor defaults

DT Editor defaults

tangerinetangerine Posts: 3,365Questions: 39Answers: 395

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: 21,322Questions: 26Answers: 4,948

    See if this thread helps.

    Kevin

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    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: 21,322Questions: 26Answers: 4,948

    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,365Questions: 39Answers: 395

    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: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

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

    Allan

Sign In or Register to comment.