server state save/load problem
server state save/load problem
first of all let me say that this is a GREAT component :)
Now the problem, i have a little load/save state problem.;
this is my datatable initialisation :
[code]
$(document).ready( function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'table/get-data'
// ome of my other properties
"bStateSave": true,
"fnStateSave": function (oSettings, oData) {
$.ajax( {
"url": "/table/state-save",
"data": oData,
"dataType": "json",
"method": "POST"
"success": function () {}
} );
"fnStateSave": function (oSettings, oData) {
$.ajax( {
"url": "/table/state-load",
"data": oData,
"dataType": "json",
"method": "POST"
"success": function (json) { o = json; }
} );
}
} );
} );
[/code]
in the save procedure i get :
[code]
ColReorder[] 0
ColReorder[] 1
ColReorder[] 2
ColReorder[] 3
ColReorder[] 4
ColReorder[] 5
ColReorder[] 6
ColReorder[] 7
ColReorder[] 8
ColReorder[] 9
ColReorder[] 10
aaSorting[0][] 0
aaSorting[0][] asc
aaSorting[0][] 0
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
aoSearchCols[0][bCaseInse... true
aoSearchCols[0][bRegex] false
aoSearchCols[0][bSmart] true
aoSearchCols[0][sSearch]
aoSearchCols[10][bCaseIns... true
aoSearchCols[10][bRegex] false
aoSearchCols[10][bSmart] true
aoSearchCols[10][sSearch]
aoSearchCols[1][bCaseInse... true
aoSearchCols[1][bRegex] false
aoSearchCols[1][bSmart] true
aoSearchCols[1][sSearch]
aoSearchCols[2][bCaseInse... true
aoSearchCols[2][bRegex] false
aoSearchCols[2][bSmart] true
aoSearchCols[2][sSearch]
aoSearchCols[3][bCaseInse... true
aoSearchCols[3][bRegex] false
aoSearchCols[3][bSmart] true
aoSearchCols[3][sSearch]
aoSearchCols[4][bCaseInse... true
aoSearchCols[4][bRegex] false
aoSearchCols[4][bSmart] true
aoSearchCols[4][sSearch]
aoSearchCols[5][bCaseInse... true
aoSearchCols[5][bRegex] false
aoSearchCols[5][bSmart] true
aoSearchCols[5][sSearch]
aoSearchCols[6][bCaseInse... true
aoSearchCols[6][bRegex] false
aoSearchCols[6][bSmart] true
aoSearchCols[6][sSearch]
aoSearchCols[7][bCaseInse... true
aoSearchCols[7][bRegex] false
aoSearchCols[7][bSmart] true
aoSearchCols[7][sSearch]
aoSearchCols[8][bCaseInse... true
aoSearchCols[8][bRegex] false
aoSearchCols[8][bSmart] true
aoSearchCols[8][sSearch]
aoSearchCols[9][bCaseInse... true
aoSearchCols[9][bRegex] false
aoSearchCols[9][bSmart] true
aoSearchCols[9][sSearch]
iCreate 1349186947583
iEnd 0
iLength 10
iStart 0
oSearch[bCaseInsensitive] true
oSearch[bRegex] false
oSearch[bSmart] true
oSearch[sSearch]
[/code]
I'm not sure what form is this or what do i have to return back :)
i try to return :
[code]{"aaSorting":[1,"des"]}[/code]
and got : TypeError: c.abVisCols is undefined
then I extended my json :
[code]{"aaSorting":[1,"des"],"abVisCols":[true,true,true,true,true,true,true,true,true,true,true]}[/code]
and i got : TypeError: k is undefined
im not sure where to go from here :)
what am i doing wrong :)
is there a list of mandatory fields i need to send?
p.s. i i'm using java spring mvc
Now the problem, i have a little load/save state problem.;
this is my datatable initialisation :
[code]
$(document).ready( function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": 'table/get-data'
// ome of my other properties
"bStateSave": true,
"fnStateSave": function (oSettings, oData) {
$.ajax( {
"url": "/table/state-save",
"data": oData,
"dataType": "json",
"method": "POST"
"success": function () {}
} );
"fnStateSave": function (oSettings, oData) {
$.ajax( {
"url": "/table/state-load",
"data": oData,
"dataType": "json",
"method": "POST"
"success": function (json) { o = json; }
} );
}
} );
} );
[/code]
in the save procedure i get :
[code]
ColReorder[] 0
ColReorder[] 1
ColReorder[] 2
ColReorder[] 3
ColReorder[] 4
ColReorder[] 5
ColReorder[] 6
ColReorder[] 7
ColReorder[] 8
ColReorder[] 9
ColReorder[] 10
aaSorting[0][] 0
aaSorting[0][] asc
aaSorting[0][] 0
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
abVisCols[] true
aoSearchCols[0][bCaseInse... true
aoSearchCols[0][bRegex] false
aoSearchCols[0][bSmart] true
aoSearchCols[0][sSearch]
aoSearchCols[10][bCaseIns... true
aoSearchCols[10][bRegex] false
aoSearchCols[10][bSmart] true
aoSearchCols[10][sSearch]
aoSearchCols[1][bCaseInse... true
aoSearchCols[1][bRegex] false
aoSearchCols[1][bSmart] true
aoSearchCols[1][sSearch]
aoSearchCols[2][bCaseInse... true
aoSearchCols[2][bRegex] false
aoSearchCols[2][bSmart] true
aoSearchCols[2][sSearch]
aoSearchCols[3][bCaseInse... true
aoSearchCols[3][bRegex] false
aoSearchCols[3][bSmart] true
aoSearchCols[3][sSearch]
aoSearchCols[4][bCaseInse... true
aoSearchCols[4][bRegex] false
aoSearchCols[4][bSmart] true
aoSearchCols[4][sSearch]
aoSearchCols[5][bCaseInse... true
aoSearchCols[5][bRegex] false
aoSearchCols[5][bSmart] true
aoSearchCols[5][sSearch]
aoSearchCols[6][bCaseInse... true
aoSearchCols[6][bRegex] false
aoSearchCols[6][bSmart] true
aoSearchCols[6][sSearch]
aoSearchCols[7][bCaseInse... true
aoSearchCols[7][bRegex] false
aoSearchCols[7][bSmart] true
aoSearchCols[7][sSearch]
aoSearchCols[8][bCaseInse... true
aoSearchCols[8][bRegex] false
aoSearchCols[8][bSmart] true
aoSearchCols[8][sSearch]
aoSearchCols[9][bCaseInse... true
aoSearchCols[9][bRegex] false
aoSearchCols[9][bSmart] true
aoSearchCols[9][sSearch]
iCreate 1349186947583
iEnd 0
iLength 10
iStart 0
oSearch[bCaseInsensitive] true
oSearch[bRegex] false
oSearch[bSmart] true
oSearch[sSearch]
[/code]
I'm not sure what form is this or what do i have to return back :)
i try to return :
[code]{"aaSorting":[1,"des"]}[/code]
and got : TypeError: c.abVisCols is undefined
then I extended my json :
[code]{"aaSorting":[1,"des"],"abVisCols":[true,true,true,true,true,true,true,true,true,true,true]}[/code]
and i got : TypeError: k is undefined
im not sure where to go from here :)
what am i doing wrong :)
is there a list of mandatory fields i need to send?
p.s. i i'm using java spring mvc
This discussion has been closed.
Replies
i have set fnStateSave to return json :
[code]
"fnStateSave": function (oSettings, oData) {
$.ajax( {
"url": "/table/state-save",
"data": 'jsonData=' + JSON.stringify(oData)",
"dataType": "json",
"method": "POST"
"success": function () {}
} );
[/code]
Allan