Exception on pressing Escape
Exception on pressing Escape
Hi there together,
I am quite new to DataTables and KeyTable but so far I really appreciate this plug-in. Keep up the good work!
However, I have a small problem with the KeyTable plug-in. I am getting an "TypeError exception: cannot read property '1' of null" when I try to hit the Escape button. The browser says it happens in KeyTable.js on line 418. I tried to trace back the error and I found out that in line 750 of KeyTable.js (key stroke handling) ...
[code] _fnSetFocus( _fnCellFromCoords(x, y) ); [/code]
... x and y are undefined and therefore _fnCellFromCoords returns null. I guess, it is like this due to the fact that I receive a blur event immediately before the escape event that invalidates both variables. Any ideas on how to fix this? I also included jEditable but I did not use any functionality of it so far if that may matter. Below, you will find my used code:
[code]
COLUMNS_NOT_VISIBLE = [3, 5, 6, 7];
$(document).ready(function() {
var table = $("#authors").dataTable({
"sDom": '<"H"lfr>Ct<"F"ip>',
"bJQueryUI" : true,
"bScrollCollapse": true,
"bScrollAutoCss": false,
"sPaginationType" : "full_numbers",
"aoColumnDefs" : [
{"bVisible" : false, "aTargets" : COLUMNS_NOT_VISIBLE }
],
// ColVis plug-in initialization parameters
"oColVis": {
"activate" : "mouseover",
"buttonText" : " ",
"bRestore" : true,
"sAlign" : "left",
},
"fnDrawCallback": function (event) {
drawColumnsButton(event);
}
});
// Bringing KeyTable (excel like navigation) to live
var keyTable = new KeyTable({
"table" : document.getElementById("authors"),
"datatable" : table,
"focus" : [1, 0],
"initScroll": true
});
keyTable.event.focus(null, null, function(cell, x, y) {
console.log("Focus X:" + x + " Y: " + y);
});
keyTable.event.action(null, null, function(cell, x, y) {
console.log("Action X:" + x + " Y: " + y);
});
keyTable.event.blur(null, null, function(cell, x, y) {
console.log("Blur X:" + x + " Y: " + y);
});
keyTable.event.esc(null, null, function(cell, x, y) {
console.log("Escape on X:" + x + " Y: " + y);
});
});
Index
Last name
Given name
Suffix
Name on paper
Last name on paper
Given name on paper
Vital status
Position
Organization
Affiliation status
Author ID
....
[/code]
I am quite new to DataTables and KeyTable but so far I really appreciate this plug-in. Keep up the good work!
However, I have a small problem with the KeyTable plug-in. I am getting an "TypeError exception: cannot read property '1' of null" when I try to hit the Escape button. The browser says it happens in KeyTable.js on line 418. I tried to trace back the error and I found out that in line 750 of KeyTable.js (key stroke handling) ...
[code] _fnSetFocus( _fnCellFromCoords(x, y) ); [/code]
... x and y are undefined and therefore _fnCellFromCoords returns null. I guess, it is like this due to the fact that I receive a blur event immediately before the escape event that invalidates both variables. Any ideas on how to fix this? I also included jEditable but I did not use any functionality of it so far if that may matter. Below, you will find my used code:
[code]
COLUMNS_NOT_VISIBLE = [3, 5, 6, 7];
$(document).ready(function() {
var table = $("#authors").dataTable({
"sDom": '<"H"lfr>Ct<"F"ip>',
"bJQueryUI" : true,
"bScrollCollapse": true,
"bScrollAutoCss": false,
"sPaginationType" : "full_numbers",
"aoColumnDefs" : [
{"bVisible" : false, "aTargets" : COLUMNS_NOT_VISIBLE }
],
// ColVis plug-in initialization parameters
"oColVis": {
"activate" : "mouseover",
"buttonText" : " ",
"bRestore" : true,
"sAlign" : "left",
},
"fnDrawCallback": function (event) {
drawColumnsButton(event);
}
});
// Bringing KeyTable (excel like navigation) to live
var keyTable = new KeyTable({
"table" : document.getElementById("authors"),
"datatable" : table,
"focus" : [1, 0],
"initScroll": true
});
keyTable.event.focus(null, null, function(cell, x, y) {
console.log("Focus X:" + x + " Y: " + y);
});
keyTable.event.action(null, null, function(cell, x, y) {
console.log("Action X:" + x + " Y: " + y);
});
keyTable.event.blur(null, null, function(cell, x, y) {
console.log("Blur X:" + x + " Y: " + y);
});
keyTable.event.esc(null, null, function(cell, x, y) {
console.log("Escape on X:" + x + " Y: " + y);
});
});
Index
Last name
Given name
Suffix
Name on paper
Last name on paper
Given name on paper
Vital status
Position
Organization
Affiliation status
Author ID
....
[/code]
This discussion has been closed.
Replies