Editor 1.7.2 Datetime Fileld Error

Editor 1.7.2 Datetime Fileld Error

tom@pdptom@pdp Posts: 19Questions: 7Answers: 0

Hello,

After I updated the Editor to the ver. 1.7.2, I started getting an error while using 'datetime' type fields.
Line 5423 in dataTables.editor.js treats them as non edit fields.

            {
                label:      "Date:",
                name:       "example.date",
                type:       "datetime",
                format:  'DD/MM/YYYY HH:mm:ss',
                def:       function () { '' },
                opts:  {
                    showWeekNumber: true
                }
                
            },

jquery.dataTables.js:2659 Uncaught TypeError: Cannot read property 'example' of undefined
at fetchData (jquery.dataTables.js:2659)
at jquery.dataTables.js:2671
at Editor.Field.valFromData (dataTables.editor.js:250)
at Editor.Field.<anonymous> (dataTables.editor.js:5424)
at Function.each (jquery.js:368)
at Object.<anonymous> (dataTables.editor.js:5416)
at Function.each (jquery.js:368)
at Editor._submit (dataTables.editor.js:5412)
at send (dataTables.editor.js:3681)
at Editor.submit (dataTables.editor.js:3703)
fetchData @ jquery.dataTables.js:2659
(anonymous) @ jquery.dataTables.js:2671
valFromData @ dataTables.editor.js:250
(anonymous) @ dataTables.editor.js:5424
each @ jquery.js:368
(anonymous) @ dataTables.editor.js:5416
each @ jquery.js:368
Editor._submit @ dataTables.editor.js:5412
send @ dataTables.editor.js:3681
Editor.submit @ dataTables.editor.js:3703
action @ dataTables.editor.js:7293
(anonymous) @ dataTables.editor.js:2236
dispatch @ jquery.js:5206
elemData.handle @ jquery.js:5014

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    You need to return something from your def function. At the moment it is returning undefined (since there is no return statement). You could use something like return new Date();.

    Allan

  • tom@pdptom@pdp Posts: 19Questions: 7Answers: 0

    Thanks, Allan. function () { return ''; }, solves the problem

This discussion has been closed.