$.fn.DataTable.Editor is not a function

$.fn.DataTable.Editor is not a function

Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0
edited June 2016 in Free community support

I am trying to use the data table editor but it throws error like $.fn.DataTable.Editor is not a function i have tried all the ways but still its same help me out with this please.

//Here is my Code

var editor; // use a global for the submit and return data rendering in the examples
 
$(document).ready(function() {
    editor = new $.fn.DataTable.Editor({
        ajax: "pages_ajax.php",
        table: "#getAllDataPages",
        fields: [ {
                label: "PAGE ID",
                name: "page_id"
            }, 
            {
                label: "PAGE NAME",
                name: "page_name"
            }, 
            {
                label: "PAGE URL",
                name: "page_url"
            }, 
            {
                label: "PAGE TEST URL",
                name: "page_test_url",
                type: "select"
            },
            {
                label: "PAGE SCREEN SHOT URL",
                name: "page_screenshot_url",
                type: "select"
            }

        ]
    } );
 
    $('#getAllDataPages').DataTable( {
        dom: "Bfrtip",
        ajax: {
            url: "pages_ajax.php",
            type: 'POST'
        },
        columns: [
            { data: "page_id" },
            { data: "page_name" },
            { data: "page_url" },
            { data: "page_test_url" },
            { data: "page_screenshot_url" }
           
        ],
         select: true,
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ]
    } );
} );

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 63,803Questions: 1Answers: 10,515 Site admin

    If you have a look in your browser's console, are there any error messages or warnings? The error you are seeing suggests that Editor hasn't been loaded, so there is an issue with its include. If you could show me your HTML and any error messages I will hopefully be able to help.

    Allan

  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0
    edited June 2016

    Yes there is an error message in my browser and that is same like that only like Uncaught TypeError: $.fn.dataTable.Editor is not a function and i have included the scripts also.

    <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
     <script src="https://cdn.datatables.net/buttons/1.2.1/js/dataTables.buttons.min.js"></script>
      <script src="https://cdn.datatables.net/select/1.2.0/js/dataTables.select.min.js"></script>
      <script type="text/javascript" src="assets/js/dataTables.editor.js"></script>
    <script type="text/javascript" src="assets/js/dataTables.editor.min.js"></script>
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0
    edited June 2016
    <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
     <script src="https://cdn.datatables.net/buttons/1.2.1/js/dataTables.buttons.min.js"></script>
      <script src="https://cdn.datatables.net/select/1.2.0/js/dataTables.select.min.js"></script>
      <script type="text/javascript" src="assets/js/dataTables.editor.js"></script>
    <script type="text/javascript" src="assets/js/dataTables.editor.min.js"></script>
    
  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0

    Actually i am trying to print my response in data table and mean while i want to use editor functionality also i have copy the code also from example but still the error is same.

  • allanallan Posts: 63,803Questions: 1Answers: 10,515 Site admin

    You need to use Markdown to mark the code - otherwise the forum strips it.

    You should only load one of dataTables.editor.js or dataTables.editor.min.js. Its the same file, just one is compressed.

    Are you loading jQuery twice on the page? That might cause the issue you are seeing.

    If you have a link to the page in question I would be able to tell you what the problem is.

    Allan

  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0

    Sorry Allan i don't know how to mark down script but i am using only one Jquery in the file.

  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0

    Ok Allan i got it how to mark down Thanks but As i have told you in the previous comment i am loading only one Jquery

  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0

    As you have mentioned in your comment i have removeddataTables.editor.js form the code but still the error is same.

  • allanallan Posts: 63,803Questions: 1Answers: 10,515 Site admin

    Can you give me a link to the page and i'll be able to debug it and understand what the issue is. If you can't make it public, send me a PM with the link by clicking my name above and then "Send message".

  • Akash MacwanAkash Macwan Posts: 8Questions: 1Answers: 0

    Sure Allan i am sending you.

This discussion has been closed.