Datatables Editor TypeError: config[(((s6F + y5f.x8 ...... is undefined
Datatables Editor TypeError: config[(((s6F + y5f.x8 ...... is undefined
I am trying to setup Editor with laravel-datatables. The Datatable alone is working well. But as soon I add the Editor Buttons I am getting a typeerror which doesn't help me at all due Editor sourcecode is heavily obfuscated. Error reads:
TypeError: config[(((s6F + y5f.x8F) + n9Y) + L8F)][(J7Y + L6m)] is undefined
[Learn More]
dataTables.editor.min.js:991:56
This builds the html of the table in PHP on server site:
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->columns($this->getColumnsDefinition())
->minifiedAjax()
->addAction(['width' => '80px'])
->parameters([
'dom' => 'Bfrtip',
'order' => [[5, 'desc']],
'buttons' => [
'upload',
'print',
'export',
'reset',
'reload',
['extend' => 'edit', 'editor' => 'editor'],
['extend' => 'remove', 'editor' => 'editor']
],
'select' => true
]);
}
/**
* Get columns definition
*
* @return array
*/
protected function getColumnsDefinition()
{
return [
'images_thumb_id' => ['title' => 'Thumbnail', 'data' => 'images_thumb_id',
'render' => '"<img src=\"render/"+data+"\" height=\"50\"/>"',
'orderable' => 'false', 'searchable' => 'false'
],
'name_org' => ['title' => 'Filename', 'data' => 'name_org',
'orderable' => 'true', 'searchable' => 'true'
],
'results' => ['title' => 'Findings', 'data' => 'results',
'orderable' => 'true', 'searchable' => 'false'
],
'status' => ['title' => 'Status', 'data' => 'status',
'orderable' => 'true', 'searchable' => 'false'
],
'comment' => ['title' => 'Comments', 'data' => 'comment',
'orderable' => 'false', 'searchable' => 'false'
],
'created_at' => ['title' => 'Uploaded', 'data' => 'created_at',
'orderable' => 'true', 'searchable' => 'false'
],
'updated_at' => ['title' => 'Last Update', 'data' => 'updated_at',
'orderable' => 'true', 'searchable' => 'false'
]
];
}
and this is my try to bind the Editor to the Datatable in JS:
var test = $("#dataTableBuilder");
var editor = new $.fn.dataTable.Editor( {
ajax: '/searches/edit',
table: '#dataTableBuilder',
fields: [
{ label: 'Comments', name: 'comment' }
]
});
console.log(editor);
Now If I spare the buttons edit and remove it seems the editor get's bound properly.
Object { s: {…}, classes: {…}, i18n: {…}, dom: {…} }classes : Object { wrapper: "DTE", processing: {…}, header: {…}, … }dom : Object { wrapper: div.DTE, form: form, formError: div.DTE_Form_Error, … }i18n : Object { create: {…}, edit: {…}, remove: {…}, … }s : Object { ajax: "/searches/edit", id: -1, displayed: false, … }proto : Object { add: function Editor.prototype.add(), background: function Editor.prototype.background(), blur: function Editor.prototype.blur(), … } dataTables.editor.custom.js:10:1
but as soon I add the 2 buttons I get the error which to be honest does not tell me nothing at all. Could be I am missing something?
Any help welcome.
Answers
Hi,
You are right - the Editor source is obfuscated during the trial.
For experience, the sort of error you are seeing happens when a field is address that doesn't exist in the Editor instance. For example your Editor configuration has a field called
comment
in it - if you tried to address it aseditor.field('Comment')
then that error would happen.Can you show me the full Javascript you are using and I might be able to spot the issue.
Thanks,
Allan