State saving does not work: "TypeError: oColumn is undefined" (line 6705)
State saving does not work: "TypeError: oColumn is undefined" (line 6705)
MiB
Posts: 15Questions: 0Answers: 0
Hi Allan,
I am trying to use the datatable as a replacement for rich:extendedDataTable. Most of the features are working, except for state saving. I always get:
TypeError: oColumn is undefined
https://localhost:8443/js/jquery.dataTables.js
Line 6705
using DataTables 1.9.4. My table initialization:
[code]
var siTable = jQuery('#table').dataTable( {
"bPaginate": false,
"bInfo" : false,
"bAutoWidth" : true,
"aoColumnDefs" : [
// do not display the internal id and status id columns
{ "bSearchable": false, "bVisible": false, "aTargets": [ "ID", "STATUS_ID" ] },
// when sorting the Status column, use the internal status id column
{ "iDataSort": [ 1 ], "aTargets": [ 2 ] }
],
"aaSorting": [[2,'desc']], // initial sorting by status column
"bStateSave" : true,
"sDom" : 'TRlrt',
"oTableTools" : {
"aButtons": [],
"sRowSelect": "single",
"sSelectedClass": "selected",
"fnRowSelected": function (nodes) {
// ....
}
}
});
[/code]
Cookies are enabled.
I'd be grateful for any hint. I still didn't find the time to update the colReorderResize thing... too much to do.
I am trying to use the datatable as a replacement for rich:extendedDataTable. Most of the features are working, except for state saving. I always get:
TypeError: oColumn is undefined
https://localhost:8443/js/jquery.dataTables.js
Line 6705
using DataTables 1.9.4. My table initialization:
[code]
var siTable = jQuery('#table').dataTable( {
"bPaginate": false,
"bInfo" : false,
"bAutoWidth" : true,
"aoColumnDefs" : [
// do not display the internal id and status id columns
{ "bSearchable": false, "bVisible": false, "aTargets": [ "ID", "STATUS_ID" ] },
// when sorting the Status column, use the internal status id column
{ "iDataSort": [ 1 ], "aTargets": [ 2 ] }
],
"aaSorting": [[2,'desc']], // initial sorting by status column
"bStateSave" : true,
"sDom" : 'TRlrt',
"oTableTools" : {
"aButtons": [],
"sRowSelect": "single",
"sSelectedClass": "selected",
"fnRowSelected": function (nodes) {
// ....
}
}
});
[/code]
Cookies are enabled.
I'd be grateful for any hint. I still didn't find the time to update the colReorderResize thing... too much to do.
This discussion has been closed.
Replies
Allan
Allan
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DataTables state
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery('#example1').dataTable( {
"bPaginate": false,
"bInfo" : false,
"bAutoWidth" : true,
"aoColumnDefs" : [
// do not display the internal id and status id columns
{ "bSearchable": false, "bVisible": false, "aTargets": [ "ID", "STATUS_ID" ] },
// when sorting the Status column, use the internal status id column
{ "iDataSort": [ 1 ], "aTargets": [ 2 ] }
],
"aaSorting": [[2,'desc']], // initial sorting by status column
"bStateSave" : true,
"sDom" : 'TRlrt',
"oTableTools" : {
"aButtons": [],
"sRowSelect": "single",
"sSelectedClass": "selected",
"fnRowSelected": function (nodes) {
alert("yes");
}
}
});
});
Status
Site ID
Region
Op. Mode
Alarm
Batt SOC
Fuel level(l)
Fuel level(%)
Predicted refill
Next maintenance
Env. Temp.
Last Life Signal
120
3
Lab-TS08
genset
solar_panel
80.4
7.9
78.5
2013-02-15
2013-02-15
79.9
2013-02-15 14:01:19
264
3
Lab-TS03
Laboratory 1
active
failed
100.0
0.0
0.0
N.A.
2013-02-15
25.0
2013-02-15 14:00:55
[/code]
Allan
And yes, it does work without prototype, but I have to delete the cookie first.... errm.. I have an idea: prototype causes the cookie to break, that's it! Here is the cookie without prototype:
[code]
{"iCreate":1361473506582,"iStart":0,"iEnd":2,"iLength":10,"aaSorting":[[2,"desc",1]],"oSearch":{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},"aoSearchCols":[{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true}],"abVisCols":[false,false,true,true,true,true,true,true,true,true,true,true,true,true],"ColReorder":[0,1,2,3,4,5,6,7,8,9,10,11,12,13]}
[/code]
and this is the cookie after it gets stored with prototype loaded:
[code]
{"iCreate":1361473550279,"iStart":0,"iEnd":2,"iLength":10,"aaSorting":"[[2, \"desc\", 1]]","oSearch":{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},"aoSearchCols":"[{\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}, {\"bCaseInsensitive\": true, \"sSearch\": \"\", \"bRegex\": false, \"bSmart\": true}]","abVisCols":"[false, false, true, true, true, true, true, true, true, true, true, true, true, true]","ColReorder":"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]"}
[/code]
Prototype makes the array a string?! Well, I guess you will be more qualified to analyse it :-)
Allan
"Make Prototype's JSON implementation EcmaScript 5 compliant."
in prototype's changelog. So I will try to replace the stringify and report back with the result in a bit.
Allan