DT Editor defaults

DT Editor defaults

tangerinetangerine Posts: 3,352Questions: 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,466Questions: 26Answers: 4,804

    See if this thread helps.

    Kevin

  • tangerinetangerine Posts: 3,352Questions: 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,466Questions: 26Answers: 4,804

    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,352Questions: 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: 62,088Questions: 1Answers: 10,180 Site admin
    Answer ✓

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

    Allan

Sign In or Register to comment.