JQuery error

JQuery error

jobybaztyjobybazty Posts: 39Questions: 0Answers: 0
edited May 2012 in General
Hi,
I am getting oData is not defined while calling the method "fnStateSave": function (oSettings, oData) to save data to DB.
How can i set the value.
Below is my full code

$(document).ready( function () {
$('table.x2f').append('Group order by(usually hidden)Call Pending NameMobile Res Tel1Res Tel2Res FaxWrk Tel1Wrk Tel2Wrk Fax NationalityCall Status ');
var oTable = $('table.x2f').dataTable({ "bLengthChange": false, "bPaginate": false , "bSearchable": true,
"bStateSave": true,
"fnStateSave": function (oSettings, oData) {
alert("=== oData === "+oData);
//Send an Ajax request to the server with the state object
$.ajax( {
"url": "/state_save",
"data": oData,
"dataType": "json",
"method": "POST",
"success": function () {}
} );
},
"fnStateLoad": function (oSettings, oData) {
alert( 'Saved filter was: '+oData.oSearch.sSearch );
}
})
.rowGrouping({ bExpandableGrouping: true,
iGroupingOrderByColumnIndex: 0,
iGroupingColumnIndex: 1});
var oSettings = oTable.fnSettings();
var oData = oSettings.aaSorting;
$('table th').click( function() {
alert("== inside function === "+oData);
});
});

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Given that this is related to your previous thread, in future could you just keep all related posts in a single thread, otherwise I get confused...!

    Which part is giving your oData undefined - my guess is the fnStateLoad function since it only gets passed one parameter (you need to get the data from the server and give it to DataTables). The documentation for that function is slightly wrong at the moment in that regard, and will be fixed with the next release.

    See this post for more information about state saving and loading: http://datatables.net/blog/localStorage_for_state_saving

    Allan
  • jobybaztyjobybazty Posts: 39Questions: 0Answers: 0
    ayooo.. sorry Mr. Allan.. what happens is, i saw the new discussion button and clicked on it. I am trying the thing that you mentioned on the link. will let you know, if i get any error. Thank you for your support Mr. Allan
  • jobybaztyjobybazty Posts: 39Questions: 0Answers: 0
    Hi Allan..
    Thank you for your support.
    I am thinking to pass the sort value to DB and set it to the datatable while page is loading. I am getting the value as 3, ASC, 0 from DB. If I get this vale, please tell me, how Can I set it to dattable to show the order?
  • jobybaztyjobybazty Posts: 39Questions: 0Answers: 0
    Hi Allan..

    I am thinking to pass the sort value to DB and set it to the datatable while page is loading. I am getting the value as 3, ASC, 0 from DB. If I get this vale, please tell me, how Can I set it to dattable to show the order?
This discussion has been closed.