problem with clearing content of datatables or ...?

problem with clearing content of datatables or ...?

josephejosephe Posts: 11Questions: 0Answers: 0
edited September 2011 in General
ask for help....

I have two datatables...if my $_SESSION changed also content of datatables changed with diferent content (dataset) with diferent filtering....
but probably there is some problem with reloading data in datatables becasuse it works strange and remember content only of first loading....
Is my clearing datatables content or destroing correct way done?

[code]
$(document).ready(function() {

if (typeof oTable1 !== 'undefined')
{
oTable1.fnDestroy();
oTable2.fnDestroy();
}



$("#tabs").tabs( {
"show": function(event, ui) {
var oTable = $('div.dataTables_scrollBody>table.display', ui.panel).dataTable();

if ( oTable.length > 0 ) {
oTable.fnAdjustColumnSizing();
}
}
} );



oTable1 = $('#example1').dataTable( {
"bJQueryUI": true,
"sScrollY": "100%",
"bDestroy": true,
"sScrollX": "100%",
"sPaginationType": "full_numbers",
"bStateSave": true,
"aaSorting": [ [1,'asc'], [2,'asc'] ],
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../pms/modules/pages/server_processing.php"
} );




oTable2 = $('#example2').dataTable( {
"bJQueryUI": true,
"sScrollY": "100%",
"bDestroy": true,
"sScrollX": "100%",
"sPaginationType": "full_numbers",
"bStateSave": true,
"aaSorting": [ [1,'asc'], [2,'asc'] ],
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../pms/modules/pages/server_processing.php"
} );



<?php

if ((isset($_SESSION['gen_new'])) && ($_SESSION['gen_new'] == 'v_tasks'))
{
echo " oTable1.fnFilter( 'Registered', 8 );
oTable2.fnFilter( 'Processing', 8 );
";

}
elseif ((isset($_SESSION['gen_new'])) && ($_SESSION['gen_new'] == 'v_projects'))
{
echo " oTable1.fnFilter( 'New', 8 );
oTable2.fnFilter( 'Active', 8 );
";
}
?>

[/code]

Replies

  • josephejosephe Posts: 11Questions: 0Answers: 0
    I found where I had mistakes....
    some mistakes in php part of shown code and also o setting up session variable before processing javascripts and found out that part of oTable1.fnDestroy(); etc is not necesery to have it....
This discussion has been closed.