Error, with inicialize the editor

Error, with inicialize the editor

GeraDuronGeraDuron Posts: 8Questions: 3Answers: 0

Hello
I have this error, my code is correcte y thing so!

Uncaught TypeError: Cannot read property 'Editor' of undefined

<

script type="text/javascript" language="javascript" class="init">

var editor;

$(document).ready(function () {
    editor = new $.fn.dataTable.Editor({
        ajax: '@Url.Action("DatosGrid", "Gestiones")',
        table: "#Presta",
        fields: [

            {
                label: "Gestionado",
                name: "Gestionado"
            },
            {
                label: "Oberservacion",
                name: "Observacion"
            },
            {
                label: "Promesa_Pago",
                name: "Promesa_Pago"
            },
            {
                label: "Nequivo",
                name: "Nequivo"
            }
        ]


    });

Answers

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

    Do you have the necessary js references in your HTML?

  • GeraDuronGeraDuron Posts: 8Questions: 3Answers: 0
    edited March 2020

    Hi, tangerine
    my js references are this





  • GeraDuronGeraDuron Posts: 8Questions: 3Answers: 0

  • kthorngrenkthorngren Posts: 21,169Questions: 26Answers: 4,922
    edited March 2020

    Uncaught TypeError: Cannot read property 'Editor' of undefined

    This error could be caused by not including datatables.js. It does look like you are but there seems to be extra text in the include line:

    You have "script" directly following language="javascript". This might not be the issue. Are you getting other errors in the browser's console? Can you post a link to your page so we can help troubleshoot?

    Kevin

  • GeraDuronGeraDuron Posts: 8Questions: 3Answers: 0

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Is that last screenshot after you removed the script tag as Kevin suggested? Are you able to link to your page so we can take a look, as Kevin also said?

    Colin

  • GeraDuronGeraDuron Posts: 8Questions: 3Answers: 0

    Upload to github, the project, so they can see the code of the page. The page is called HacerGesti_Ase_2,

    https://github.com/GeraDuronhn1990/Portal.git

  • allanallan Posts: 63,208Questions: 1Answers: 10,415 Site admin

    Try removing this line from that file please:

    <script type="text/javascript" language="javascript" src="~/Scripts/DataTables/datatables.js"></script
    

    The reason for removing that line is that you are already including the JS files individually.

    If that doesn't fix it, can you open your browser's console and type: $.fn.dataTable - does it show undefined or an object? If an object, what does $.fn.dataTable.Editor show?

    Thanks,
    Allan

    p.s. When we are finished debugging this issue, could you possibly delete Editor from the public repo please?

  • GeraDuronGeraDuron Posts: 8Questions: 3Answers: 0

    Hi, Allan
    when resolve the issue, i deletd, the repor and in the console apper this,
    and change import of the lib of JS

This discussion has been closed.