Uncaught TypeError: $(...).dataTable is not a function

Uncaught TypeError: $(...).dataTable is not a function

GeaGea Posts: 33Questions: 13Answers: 1

Hello, how you can see in the tittle, i have an a Uncaught TypeError: $(...).dataTable is not a function..
I'm trygin to use Jeditable on my DataTable.
This is my code:
$( document ).ready(function() {

var tabla = $('#example').dataTable("ajax": "data.json",



    "columns": [
        {"data": "NIF/NIE"},
        {"data": "1er Apellido"},
        {"data": "2do Apellido"},
        {"data": "Nombre"},
        {"data": "Sexo"},
        {"data": "Fecha Nacimiento"},
        {"data": "Fecha Contrato"},
        {"data": "Demandante empleo larga duracion"},
        {"data": "Tipo Contrato"},
        {"data": "% Jornada"},
        {"data": "Discap"},
        {"data": "Causas Archivo"},
        {"data": "Aut SCSP"},
        {"data": "Imp Solic"},
        {"data": "Sust"}


    ]
     ).makeEditable();

});

These are my libraries:
src="resources/js/jquery.js" type="text/javascript"
src="resources/js/jquery.dataTables.js" type="text/javascript"
src="resources/js/jquery.jeditable.js" type="text/javascript"
src="resources/js/jquery-ui.js" type="text/javascript"
src="resources/js/jquery.validate.js" type="text/javascript"
src="resources/js/jquery.dataTables.editable.js" type="text/javascript"

I think my error is on the libraries, because when i don't use the jeditable library there is no error,( the error would be in this case: makeEditable is not a function, but i could see the DataTable ) but if i want to use .makeEditable() i have to implement that...
Any ideas?
Thanks!

Answers

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin

    This will normally happen if you include jQuery twice on a page. Are you including it else where?

    Allan

  • GeaGea Posts: 33Questions: 13Answers: 1

    Hello again, i resolve this problem changing one library, but now i have another problem...
    The Datatable is not showing the td...
    This is my HTML table:
    <body id="dt_example">

    <button id="addRow">Insertar fila</button>
    <button id="saveData">Guardar datos</button>
    <div id="dynamic">
        <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
            <tbody>
                <tr>
                    <td width="10%">NIF/NIE</td>
                    <td width="10%">1er Apellido</td>
                    <td width="10%">2do Apellido</td>
                    <td width="10%">Nombre</td>
                    <td width="10%">Sexo</td>
                    <td width="10%">Fecha Nacimiento</td>
                    <td width="10%">Fecha Contrato</td>
                    <td width="10%">Demandante empleo larga duración</td>
                    <td width="10%">Tipo Contrato</td>
                    <td width="10%">% Jornada</td>
                    <td width="10%">Discap.</td>
                    <td width="10%">Causas Archivo. (1)</td>
                    <td width="10%">Aut. SCSP</td>
                    <td width="10%">Imp.Solic.</td>
                    <td width="10%">Sust.</td>
    
    
    
    
                </tr>
            </tbody>
        </table>
    </div>
    

    </body>

    The Datatable show the JSON datas, but not the HTML table... any ideas?
    Thanks Allan.
    Gea.

  • GeaGea Posts: 33Questions: 13Answers: 1

    I resolved it changing td for th and adding a <thead></thead> tag.
    Thanks :)

This discussion has been closed.