How to download data after filtering with server side datatable

How to download data after filtering with server side datatable

arievthaarievtha Posts: 2Questions: 0Answers: 0
edited November 2013 in TableTools
Hallo, Iam new in here and this my first posting, but I always looking in this site when I need a references about datatable.

I want to download my data after filtering with datatable server-side in xls or csv format, but I don't get an idea how to do. I tried using table tools v2, but only print button which is working in my site.
what else should I do to download my data?

Thank's for datatables.net :)

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    > but only print button which is working in my site.

    Please link to a test case as noted in the forum rules. At the moment we have no idea why it isn't working for you - sorry.

    Also note that TableTools is a client-side script, while you specifically not that you are using server-side processing. So not all of the data is available at the client-side, and thus TableTools can only export what is currently visible in the table.

    Allan
  • arievthaarievtha Posts: 2Questions: 0Answers: 0
    edited November 2013
    [code]var oTable = $('#table_id').dataTable( {
    "oLanguage": {
    "sSearch": "Search all columns:"
    },
    "bProcessing": true,
    "bServerSide": true,
    "bStateSave": true,
    "sPaginationType": "full_numbers",

    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "TableTools-2.0.0/media/swf/copy_csv_xls_pdf.swf",
    "aButtons": [ {
    "sExtends": "download",
    "sButtonText": "Download CSV",
    "sUrl": "TableTools-2.0.0/media/script/generate_csv.php"
    } ]
    },[/code]

    and my generate_csv.php

    [code]<?php
    header('Content-type: text/csv');
    header('Content-Disposition: attachment; filename="downloaded.csv"');

    echo 'ID BANK,BULAN,TAHUN,JENIS UANG,JENIS SEKTOR, RASIO NPL'."\n";
    echo 'Body1,Body2'."\n";
    ?>[/code]

    I don't know, how should I write in my generate_csv.php, please help me
This discussion has been closed.