TableTools with serverside processing
TableTools with serverside processing
Hi,
first, thanks Alan for this great job.
My question is, i'm using dataTables with serverside processing , works perfect.
I have 50 000 rows, i use ajax processing, like this :
[code]jQuery('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sDom": 'T<"clear">lfrtip',
"sPaginationType": "full_numbers",
"sAjaxSource": "stat-export/stat_getdata.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
jQuery.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
} );[/code]
With TableTools it's almost good , the only thing is when i try to save as csv (or xls) , it's saving only the data present in the DOM (Display records), is there a way to save all data at once (50 000) ?
first, thanks Alan for this great job.
My question is, i'm using dataTables with serverside processing , works perfect.
I have 50 000 rows, i use ajax processing, like this :
[code]jQuery('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sDom": 'T<"clear">lfrtip',
"sPaginationType": "full_numbers",
"sAjaxSource": "stat-export/stat_getdata.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
jQuery.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
} );[/code]
With TableTools it's almost good , the only thing is when i try to save as csv (or xls) , it's saving only the data present in the DOM (Display records), is there a way to save all data at once (50 000) ?
This discussion has been closed.
Replies
As you have noticed with server-side processing, TableTools is more focused on the client-side part. One reason for this is that there is a limit to the amount of data that can be sent of the JS / Flash bridge - which your 50'000 records would almost certainly hit.
As such, what I think you'll need to do is modify TableTools to send a request to the server to create and download a file, rather than having Flash do it. It should be a fairly simple process to hack TableTools to send the required XHR and then output the file which the browser will save.
Hope this helps,
Allan
thanks for your reply.
Which function should i have to hack in TableTools.js , is fnGetDataTablesData ?
Possibly fnGetDataTableData - you could make an XHR request to get everything using that - and that would do the trick for all of the functions, if you want to use the Flash interface to create and save the files. But as I noted, I think you'll run into problems with this. Probably better to send an XHR from fnFeatureSaveXLS or fnFeatureSaveCSV to request that the server create the required file.
Regards,
Allan
Could you please share codes or files with me, cause I'm focusing tabletools (exporting csv, xls, pdf) in server side.
Thanks.
Allan
im new to programming and table tools.i am using server side php could you please post the sample js code and php code. with the table tools alt initiation... thnks
If possible in JAVA.
Is there any javascript only version of this?
include_once("../conf.php");//configure file
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
// $ratelistquery = mysql_query("select * from cc_ratecard where id_trunk !='-1' limit 0,50") or die("error in something cc_ratecard");
$aColumns = array( 'id', 'id_trunk', 'dialprefix', 'destination', 'buyrate','buyrateinitblock','buyrateincrement','Grace', 'id' );
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";
/* DB table to use */
$sTable = "cc_ratecard";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/*
* Local functions
*/
function fatal_error ( $sErrorMessage = '' )
{
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
die( $sErrorMessage );
}
/*
* Paging
*/
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
intval( $_GET['iDisplayLength'] );
}
/*
* Ordering
*/
$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i
Allan