Fnclick on button results in "null is not an object (evaluating 'editor.i18n')"

Fnclick on button results in "null is not an object (evaluating 'editor.i18n')"

ekkerothekkeroth Posts: 19Questions: 6Answers: 0

dataTables v.10.7
Editor v 1.5.2

This is a very strange problem:
I have two identical Editors. Both are called via a click on a button (still TableTools). The first editor loads perfectly. The second produces the above mentioned error.
If I call the first editor with the second button, the editor loads correctly.

this is the code for the first editor

/*-----------------------------START Remarks editor for Letters------------------------------------------------*/
remarksEdit = new $.fn.dataTable.Editor( {
         ajax: "../php/DTE/letters.php",
            table: "#letters",
        fields: [ {
                label: "Remarks:",
                name:  "letters.remarks",
                type:  'textarea',
                attr: {
                    placeholder: "Please enter a comment here"
                }
            }
        ]
    } );

and here comes the code for the second editor

/*-----------------------------START Remarks editor for Files------------------------------------------------*/
remarksFilesEdit = new $.fn.dataTable.Editor( {
         ajax: "../php/DTE/files.php",
            table: "#files",
        fields: [ {
                label: "Remarks:",
                name:  "files.remarks",
                type:  'textarea',
                attr: {
                    placeholder: "Please enter a comment here"
                }
            }
        ]
    } );

The error is triggered in dataTables.editor.js at line 6450.

Has anyone an idea what I do wrong?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Are you able to give me a link to the page so I can debug it please?

    Thanks,
    Allan

  • ekkerothekkeroth Posts: 19Questions: 6Answers: 0

    I installed it on a public server:

    http://www.co-gmbh.com/GH-BDMS/public/BMISinit.php

    It is the Remarks button on either tab

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Thanks for the link. It looks like a code order issue. Specifically:

     {sExtends:    "editor_edit", editor: remarksFlsEdit,
                        sButtonText: "Remarks_fls"
                        },
    

    is being run before remarksFlsEdit has been initialised. So it is undefined at the time of initialisation and hence the issue.

    If you initialise that Editor before using it, I think it should be resolved.

    Allan

  • ekkerothekkeroth Posts: 19Questions: 6Answers: 0

    Thanks Allan,

    spot on!! Works now. I will remember that.
    I shall take the link offline again.

    Ekke

This discussion has been closed.