Editor is not defined && define is not defined.
Editor is not defined && define is not defined.
Hi y'all,
I've got this error with Editor.. Uncaught ReferenceError: editor is not defined ...
I get it with the code below, but it works fine except that search and paging isn't working. It loads the first page and not much more..
My editor in the code below is called "editorUVID2", and if I change it to "editor", then the error is gone and search and paging works?
The other error, Uncaught ReferenceError: define is not defined, is referring to dataTables.editor.min.js:1, and nothing else. How to fix that?
Ty in advance
<body class="dt-example">
<div class="container" style="float: left">
<section>
<h1>UVID</h1>
<div id ="uvidFormTable">
<fieldset class="ENGSNIPUVID">
<legend>Engelsk</legend>
<editor-field name="scan_vendor"></editor-field>
<editor-field name="vendor_id"></editor-field>
<!-- <editor-field name="identifier_id"></editor-field>-->
<editor-field name="vuln_title"></editor-field>
<editor-field name="type"></editor-field>
<editor-field name="area"></editor-field>
<editor-field name="base_cvss"></editor-field>
<editor-field name="severity"></editor-field>
<editor-field name="vuln_descr"></editor-field>
<editor-field name="vuln_conseq"></editor-field>
<editor-field name="vuln_solution"></editor-field>
</fieldset>
<fieldset class="DKSNIPUVID">
<legend>Dansk</legend>
<editor-field name="snip_lang_title"></editor-field>
<editor-field name="lang_description"></editor-field>
<editor-field name="snip_lang_recom"></editor-field>
<editor-field name="notes"></editor-field>
</fieldset>
</div>
<table id="uvidOverviewTable" class="display" style="float: left">
<thead>
<tr>
<th>scan vendor</th>
<th>vendor</th>
<th>vuln title</th>
<th>type</th>
<th>area</th>
<th>base_cvss</th>
<th>severity</th>
<th>vuln descr</th>
<th>vuln conseq</th>
<th>solution</th>
<th>language </th>
<th>title</th>
<th>recom</th>
<th>description</th>
<th>notes</th>
</tr>
</thead>
</table>
</section>
</div>
</body>
<script>
let editorUVID2; // use a global for the submit and return data rendering in the examples
$(document).ready(function() {
editorUVID2 = new $.fn.DataTable.Editor( {
ajax: {
create: {
type: 'POST',
url: '../backend/backendCRUD/uvidCRUD/create.php'
},
edit: {
type: 'POST',
url: '../backend/backendCRUD/uvidCRUD/edit.php?id=_id_'
},
remove: {
type: 'POST',
url: '../backend/backendCRUD/uvidCRUD/remove.php?id=_id_'
}
},
table: "#uvidOverviewTable",
template: "#uvidFormTable",
fields: [
{
label: "Scan vendor",
name: "scan_vendor",
},
{
label: "vendor id",
name: "vendor_id"
},
{
label: "Title",
name: "vuln_title"
},
{
label: "Type",
name: "type"
},
{
label: "Area",
name: "area"
},
{
label: "Cvss",
name: "base_cvss"
},
{
label: "Severity",
name: "severity"
},
{
type : "textarea",
label: "Description",
name: "vuln_descr"
},
{
type: "textarea",
label: "Consequence",
name: "vuln_conseq"
},
{
type: "textarea",
label: "Solution",
name: "vuln_solution"
},
{
label: "language",
name: "snip_language"
},
{
label: "Title",
name: "snip_lang_title"
},
{
type: "textarea",
label: "Solution",
name: "snip_lang_recom"
},
{
type: "textarea",
label: "Description",
name: "lang_description"
},
{
type: "textarea",
label: "Notes",
name: "notes"
}
]
} );
$('#uvidOverviewTable').DataTable( {
dom: "Blfrtip",
ajax: {
url: "../backend/getUvidBack.php",
type: 'POST'
},
processing: true,
serverSide: true,
responsive: true,
columns: [
{
data: "scan_vendor"
},
{
data: "vendor_id"
},
{
data: "vuln_title"
},
{
data: "type"
},
{
data: "area"
},
{
data: "base_cvss"
},
{
data: "severity"
},
{
data: "vuln_descr",
render: function ( data, type, row ) {
if (data != null){
return data.length > 10 ?
data.substr( 0, 10 ) +'…' :
data;
}
},
},
{
data: "vuln_conseq",
render: function ( data, type, row ) {
if (data != null){
return data.length > 10 ?
data.substr( 0, 10 ) +'…' :
data;
}
},
},
{
data: "vuln_solution",
render: function ( data, type, row ) {
if (data != null){
return data.length > 10 ?
data.substr( 0, 10 ) +'…' :
data;
}
},
},
{
data: "snip_language"
},
{
data: "snip_lang_title"
},
{
data: "snip_lang_recom",
render: function ( data, type, row ) {
if (data != null){
return data.length > 10 ?
data.substr( 0, 10 ) +'…' :
data;
}
},
},
{
data: "lang_description",
render: function ( data, type, row ) {
if (data != null){
return data.length > 10 ?
data.substr( 0, 10 ) +'…' :
data;
}
},
},
{
data: "notes",
render: function ( data, type, row ) {
if (data != null){
return data.length > 10 ?
data.substr( 0, 10 ) +'…' :
data;
}
return data;
},
},
],
select: true,
buttons: [
{ extend: "create", editor: editorUVID2 },
{ extend: "edit", editor: editorUVID2 },
{ extend: "remove", editor: editorUVID2 },
]
} );
} );
</script>
This question has an accepted answers - jump to answer
Answers
Hi @esmurf ,
You would normally get those errors if you aren't including the correct sources. If you look at this example here, ensure you have the necessary files listed on the Javascript and CSS tabs beneath the table. Are you using a trial version of Editor, or licensed?
Cheers,
Colin
hi @colin
Ty for reply.
It's licensed, and I've just checked for the necessary files and I got all of them. You can see my JS and CSS below. I'm using Editor-php-1.7.4.
I've changed computer several times and copied my project over for further development. Could that have effected it somehow?
Kind regards,
Esmurf.
Remove these two lines:
They are specific to our demos and assume certain things about the source (e.g. that there is a variable called
editor
).Allan