Cannot set property 'sButtonText' of undefined
Cannot set property 'sButtonText' of undefined
I end up with this error when initializing editor using setting similar to the DOM sourced example. If I initialize the datatable without editor I get the previously mentioned bug where editor_create buttons etc. are not recognized. This is not cleared up by going to the nightly build of tabletools. Is this an issue with the versions of datatables, tabletools, and editor that I am using, or is it somewhere in my rather basic javascript?
var editor;
var table;
$(document).ready(function () {
editor = new $.fn.dataTable.Editor({
"domTable": "#optable",
"ajaxUrl": {
"create": "@Url.Action("Create")",
"edit": "@Url.Action("Edit")",
"remove": "@Url.Action("Delete")"
},
"fields": [{
"label": "Operator ID: ",
"name": 0
},{
"label": "First Name:",
"name": 1
}, {
"label": "Last Name:",
"name": 2
}, {
"label": "Department ID:",
"name": 3
}, {
"label": "Do Not Use In List: ",
"name": 4
}, {
"label": "NTLogin: ",
"name": 5
}, {
"label": "Permission Level: ",
"name": 6,
}]
});
table = $("#optable").dataTable({
"sDom": 'Tfrtip',
"domTable" : "#optable",
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
});
});
Any insight would be much appreciated
var editor;
var table;
$(document).ready(function () {
editor = new $.fn.dataTable.Editor({
"domTable": "#optable",
"ajaxUrl": {
"create": "@Url.Action("Create")",
"edit": "@Url.Action("Edit")",
"remove": "@Url.Action("Delete")"
},
"fields": [{
"label": "Operator ID: ",
"name": 0
},{
"label": "First Name:",
"name": 1
}, {
"label": "Last Name:",
"name": 2
}, {
"label": "Department ID:",
"name": 3
}, {
"label": "Do Not Use In List: ",
"name": 4
}, {
"label": "NTLogin: ",
"name": 5
}, {
"label": "Permission Level: ",
"name": 6,
}]
});
table = $("#optable").dataTable({
"sDom": 'Tfrtip',
"domTable" : "#optable",
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
});
});
Any insight would be much appreciated
This discussion has been closed.
Replies
The load order for the scripts should be:
1. jQuery
2. DataTables
3. TableTools
4. Editor
Might 3 and 4 be swapped around?
Allan
I was having the same problem, the order of the scripts being loaded was indeed the issue. Thanks!