$.fn.dataTable.Editor is not a constructor and remote hosting of code not allowed

$.fn.dataTable.Editor is not a constructor and remote hosting of code not allowed

Sadam MathikSadam Mathik Posts: 1Questions: 1Answers: 0
edited June 2016 in Free community support

The Headers as follows,

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.2.1/css/buttons.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://editor.datatables.net/extensions/Editor/css/editor.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.2.0/css/select.dataTables.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://formden.com/static/cdn/bootstrap-iso.css" />
<script src="//code.jquery.com/jquery-1.12.3.js"></script>
<script src="https://editor.datatables.net/extensions/Editor/js/dataTables.editor.min.js"></script>
<script src="https://cdn.datatables.net/select/1.2.0/js/dataTables.select.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.1/js/dataTables.buttons.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.14.4/jquery.min.js"></script>
<script src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>

The main part of code where error reflects,

$(document).ready(function() { 
var editor = new $.fn.dataTable.Editor( {
 ajax: {
  modify: {
    type: 'POST',
    url:  '/modifyrow/',
}
},

table: "#table",
fields: [ {
        label: "IP:",
        name: "ip"
    }, {
        label: "FQDN:",
        name: "fqdn"
    }, {
        label: "Server Name:",
        name: "server_name"
    }, {
        label: "Server Owner:",
        name: "serverowner"
    }, {
        label: "Application Name:",
        name: "application_name"
    }, {
        label: "App support contact:",
        name: "app_support_conatct",
    }, {
        label: "console:",
        name: "console"
    },{
        label: "Machinr Type:",
        name: "machine_type"
    }, {
        label: "Site Type:",
        name: "site_type"
    }
]
} );

// Activate an inline edit on click of a table cell
$('#table').on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.inline( this, {
    buttons: { label: '&gt;', fn: function () { this.submit(); } }
} );
} );

// var data = response['data'];
        
             $('#table').DataTable( {
                  dom: "Bfrtip",

                 "ajax": {
                      "url": "/state/",
                      "data": "data",
                 },
                 
                 columns: [
                        {
                         data: null,
                         defaultContent: '',
                        className: 'select-checkbox',
                         orderable: false
                     },
                          { data:'ip'},
                {data:'fdqn'},
                {data:'server_name'},
                {data: 'serverowner'},
                {data:'application_name'},
                {data:'app_support_conatct'},
                {data:'console'},
                {data:'machine_type'},
                {data:'site_type'},

                      ],
order: [ 1, 'asc' ],
select: {
    style:    'os',
    selector: 'td:first-child'
},
buttons: [
    
    { extend: "modify",   editor: editor }
   
]
} );
});

HTML CODE:

<div id="mod_Table">
<table class="table table-bordered table-hover table-active"
id="table">
<thead>
<tr>
<th>IP</th>
<th>FQDN</th>
<th>Server Name</th>
<th>Server Owner</th>
<th>Application Name</th>
<th>App Support Conatct</th>
<th>Console</th>
<th>Machine Type</th>
<th>Site Type</th>
</tr>
</thead>
</table>
</div>

I dont know where i made mistake.Please kindly help with this.

Answers

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin

    Just as the error message states, you can't use Editor directly from the Editor server. You need to download your own trial or licensed code and host the file locally.

    Allan

This discussion has been closed.