Editor: Stop calendar from opening automatically

Editor: Stop calendar from opening automatically

rldean1rldean1 Posts: 141Questions: 66Answers: 1
edited May 2019 in Free community support

I'm using DT Editor. Moment.js is loaded.

You can specify a datetime field in DT Editor, like this:

                fields: [
                    {
                        label: "Effective Date:",
                        name: "EffectDate",
                        type: "datetime",
                        format: 'MM-DD-YYYY'
                    },

However, when you Edit the row, after the editor window pops up, the calendar automatically opens. It hides (covers) the other fields. Also, I should mention that it's the first field.

How do I stop auto open from happening on the datetime field?

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394
    Answer ✓

    Editor gives focus to the first input field by default.

    You can find alternative behaviours here:
    https://editor.datatables.net/reference/type/form-options

  • rldean1rldean1 Posts: 141Questions: 66Answers: 1

    That worked! Added the following formOptions to stop auto-focus on datetime field which was covering the other fields.

                    formOptions: {
                        main: {
                            /**
                             * https://editor.datatables.net/reference/type/form-options
                             */
                            focus: null
                        }
                    },
    
This discussion has been closed.