TableTools v1.0.2 - Save as Excel, CSV, copy and print! - Page 5

TableTools v1.0.2 - Save as Excel, CSV, copy and print!

1235

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    I must be misunderstanding something. DataTables does not have the power to trigger any PHP functions unless you explicitly tell it to via your page request. If what you mean is, "Why does it do a data request," this is because if you have server-side processing enabled, the full data set does not actually live on the client side; you have to request it from the server so that it can be printed.

    As for why TWO requests get triggered, this I do not know.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Sounds very odd - I'm not sure why it would be doing two draws either, and I've not actually been able to reproduce that I'm afraid.

    Also as Greg notes, I'm not sure that DataTables could do the background processing you refer to, since all Ajax requests to the server are to some degree seen as background processes to the Javascript! You might be able to do a "loading" message, but that would probably require a little change to the TableTools code to get that in there - or perhaps the bProcessing option of DataTables to show a processing message when the XHR is sent out, until it returns.

    Allan
  • scowles4scowles4 Posts: 2Questions: 0Answers: 0
    We're using the TableTool buttons to enable copy and export to CSV (among other bulk actions) but we are serving many customers that don't have flash enabled. Right now they appear broken, as the "missing plugin" note appears over the button text.

    Does anybody know how I can set up these buttons to be hidden if flash is not enabled?

    Thanks!
  • gunnduncangunnduncan Posts: 1Questions: 0Answers: 0
    Thanks to Aysa, I was also needing to hide a column from my export (an Actions column) and while this is perhaps not the most scalable of approaches it works great!
  • kanyungukanyungu Posts: 3Questions: 1Answers: 0
    The above forum is very informative - thanks
  • arasusearasuse Posts: 3Questions: 0Answers: 0
    For some reason TableTools not working for me I have created a post
    http://datatables.net/forums/discussion/7677/tabletools-not-working

    I just want to call the excel function or pdf function for my own button tag( during onclick). Is that possible
  • beeXtreembeeXtreem Posts: 1Questions: 0Answers: 0
    edited January 2012
    Hi Allan,

    Thanks for such an awesome add-on. Thank You! Thank You! THANK YOU!!! :)

    I have a bit of a question though. The save to CSV feature is just what I need, but it only saves the data currently available in a paged datatable :(. Is there anyway to pull all the data as is done in the print feature, without using the ajax download feature - which I can't seem to get to work properly?

    Thanks again.

    Best regards,
    Benjamin.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    @arasuse

    > I just want to call the excel function or pdf function for my own button tag( during onclick). Is that possible

    No - because of Flash security restrictions. You must overlay the Flash movie clips on top of any elements you want to be able to do the export from. So you could do it, but you'd need to put the flash movies in as well.

    @beeXtreem:

    > The save to CSV feature is just what I need, but it only saves the data currently available in a paged datatable :(

    You are using server-side processing are you? The thing to be aware of is that TableTools is entirely client-side based, so the data that is exported is what DataTables currently knows about. The print feature "works" in this case because it sets the table length to -1. So it would be possible to modify TableTools to allow this behaviour (i.e. make an Ajax request for all data), but if you are doing that, you might as well ditch server-side processing and just use fully client-side processing, allowing everything to work as expected :-). Worth turning on deferred rendering if you do that for a bit more speed.

    Regards,
    Allan
  • R0bb0bR0bb0b Posts: 1Questions: 0Answers: 0
    I am attempting to use datatables for a data UI which serves many purposes and it would be an excellent fit if only I could choose the character to delimit the data on export. Is this possible?
  • marcfarrowmarcfarrow Posts: 28Questions: 0Answers: 0
    I ran across something which might be something out of scope of TableTools, but I wanted to pass it along. A co-worker of mine was testing my TableTools implementation on Windows and her folder options are set to "Hide extensions for known file types". When she exports to CSV or PDF, then file extension doesn't show up in the save as dialog button. If just just saves the file without changing the name, it will save the file with the proper file extension. If she changes the name at all, the file extension is lost. After digging into it, I realized the above setting was active on her machine. I turned it off and you can see why the file extension is lost when you change the name. With the option turned off, the save as dialog shows the extension and makes it intuitive for the user to remember to add the file extension when entering a file name. I know nothing of flash, nor the save as dialog that is generated, but is it possible to somehow add attributes to the dialog for the "Save as type:" entry to include the correct selectable types (i.e. CSV for csv and PDF for pdf)?
  • melphmelph Posts: 37Questions: 1Answers: 0
    I would also be interested in the above, if it is possible?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    marcfarrow (and presumably melph): This is not possible as far as I am aware. It is a limitation in how Flash presents the save file dialogue and there is no control over that sadly.

    Allan
  • vinitsharmavinitsharma Posts: 23Questions: 0Answers: 0
    Can we have formatted output of the excel file.? In my excel file, I only need to set the widths of the various columns in my excel file so that it looks good and not clumsy. Can I avail this anyhow? By doing something with any of the .SWF or .AS files? Please tell if its being possible. Thanks in advance.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    You can control the widths of columns a little bit in the PDF output through the fnCalcColRatios function in TableTools (it is an internal function so you need to look at the source to understand and make the modifications you want).

    Currently TableTools doesn't not support setting the widths of columns for Excel out. That is a feature that I hope to add in the future.

    Allan

    ps. Please don't cross post the same question ( http://datatables.net/forums/discussion/4498/table-tools-pdf-add-style-at-least-bold-and-italic#Item_11 ). It only leads to me having less time to answering questions.
  • DataTables_DataTables_ Posts: 1Questions: 0Answers: 0
    edited October 2012
    Hey Allan,

    The demo link http://datatables.net/1.5-beta/extras/TableTools/ is broken.
    Where can I find a demo?

    Thank you!
  • markummarkum Posts: 2Questions: 0Answers: 0
    edited December 2012
    (post superceded)
  • markummarkum Posts: 2Questions: 0Answers: 0
    Hello,
    I seem to have the same need as vinitsharma - formatted export to Excel. I'm interested in doing this myself but want to make sure this is a good idea.

    The xml format seems most promising - the schema for Excel is clear and relatively concise. There are other file format alternatives, but they strip out the formatting and/or involve binary files (and the ods format even requires a zip step) so they seem less attractive.

    Has anybody else tried this? Has an opinion on this?

    Thanks in advance
  • AA23AA23 Posts: 13Questions: 0Answers: 0
    $("#table1").dataTable({
    "bJQueryUI": true,
    //"sPaginationType": "full_numbers",
    "bProcessing": true,
    "bServerSide": true,
    "bDestroy": true,
    "bAutoWidth": true,
    "sScrollX": "940px",
    //"sScrollY": "250px",
    "bScrollCollapse": true,
    //"sDom": 'T<"clear">lfrtip',
    "sDom": '<"H"Tfr>t<"F"ip>',
    "aoColumns": [
    null,
    null,
    null,
    null,
    null,
    null,
    { "bSortable": false }
    ],
    "oTableTools": {
    "sSwfPath": "/swf/copy_csv_xls_pdf.swf"
    "sAjaxSource": url,
    "fnServerData": function ( sSource, aoData, fnCallback ) {
    $.ajax( {
    "dataType": 'json',
    "type": "POST",
    "url": sSource,
    "data": aoData,
    "success": fnCallback
    } );

    }
    });

    });
  • AA23AA23 Posts: 13Questions: 0Answers: 0
    This is my code .. I am unable to use tabletools plugin. I have added all the js ,css and swf files,but i am only able to view the buttons GUI of tabletools but nothing happens when i click on it. only the print command works.
    Please somebody suggest me a solution. I stuck on it from a long time.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    As always, please link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • JQueryUserJQueryUser Posts: 1Questions: 0Answers: 0
    Hi Allan,

    I am new to JQuery and I used table tools in 1 of my app.

    Its is of great use and reduces lot of work. Thanks for providing that.

    But I am facing issue with Print.
    There are more than 15 columns in the datatable that i am displaying, when i hit the Print button of table tool, it displays all the columns in the "Print Preview" but when I Print Out the page, hardly 6 columns are printed out, rest are getting cropped.

    If i make some printer settings, to accomodate all the columns while print out then the number of rows get cropped.

    Any solution to this?

    Thanks in advance..
  • kasdegakasdega Posts: 1Questions: 0Answers: 0
    Allan -
    We're having trouble with the CSV/EXCEL options...If the content of the cell is something like "something" when we click the csv or excel options, it magically chops the last ">"???

    Thanks!
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Please link to a test case showing the problem: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
  • ikhlasikhlas Posts: 1Questions: 0Answers: 0
    Hi

    I am getting datatable with its all feature and also getting export button in datatable as Copy Csv Excel PDF Print above also which makes to export in respective format and it "click" also but not generate to to new dialog box for saving this datatable in particular above mention formats. plz help


    @**@
    @**@
    @**@
    @**@





    .fna {
    text-transform: capitalize;
    }




    $(document).ready(function () {
    var oTable = $('#data_table3').dataTable({

    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
    },
    "bServerSide": true,
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "sAjaxSource": "/Home/AjaxDynamicDataTableHandler",
    "bProcessing": false,
    "aoColumns": [
    { "sName": "userid" },
    { "sName": ("fname") },
    { "sName": "lname" },
    { "sName": "gender" },
    { "sName": "birthdate" },
    { "sName": ("emailid") },
    { "sName": "password" },
    ]
    });

    });
  • jqueryIssuesjqueryIssues Posts: 9Questions: 2Answers: 0
    Hi Allan

    My table buttons are working only for 1st tab.After inserting this code,1st button starts working for all tabs but next 2 doesn't .When I click on 3rd button(say pdf),it performs function of 2nd one(say csv) and when I click 2nd button ,it doesn't work at all.If I click all tabs even once then all buttons on all tabs work fine.

    $( "#demoTabs" ).tabs({

    "show": function(event, ui) {

    var jqTable = $('table.dataTable', ui.panel);
    // var jqTable = $.fn.dataTable.fnTables(true);


    if ( jqTable.length > 0 ) {

    var oTableTools = TableTools.fnGetInstance( jqTable[0] );

    // var oTableTools = TableTools.fnGetInstance( 'applicationListTable' );
    alert(jqTable.length);
    // var oTableTools = TableTools.fnGetMasters();

    if ( oTableTools != null && oTableTools.fnResizeRequired() ) {

    /* A resize of TableTools' buttons and DataTables' columns is only required on the * first visible draw of the table */
    alert("in if");
    $(jqTable).dataTable().fnAdjustColumnSizing();

    oTableTools.fnResizeButtons();

    }

    }
    }
    });

    $("#applicationListTable").dataTable({
    "aLengthMenu" : [[ 20, 50, 100, -1 ],[ 20, 50, 100, "All" ] ],
    iDisplayLength : 20,
    "sPaginationType" : "full_numbers",
    "bJQueryUI" : true,
    "sDom" : 'T<"clear">lfrtip' ,
    "oTableTools" : {
    "aButtons" : [ "copy", "csv", "pdf" ],
    "sSwfPath" : "/identityapps/ext/jquery/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
    },
    "aoColumns" : [
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]},
    { "asSorting" : [ "asc", "desc" ]}
    ]
    });
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    @jqueryIssues - see http://datatables.net/forums/discussion/5859/tabletool-problem-when-hiding-datatable_wrapper/p1 among various others (search for fnResizeRequired )

    Allan
  • jqueryIssuesjqueryIssues Posts: 9Questions: 2Answers: 0
    Hi Allan,

    I am using fnResizeRequired and fnResizeButtons,but still its not working.I am using this :-
    1.var jqTable = $('table.dataTable', ui.panel);

    2.var jqTable = $('table.display', ui.panel);
    2nd is not working for me,vene copy stops working after that. Will it make any change?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    In that case, please link to a test case as noted here: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • jqueryIssuesjqueryIssues Posts: 9Questions: 2Answers: 0
    Hi Allan,

    For test case,from where it will pick default js files?
  • jqueryIssuesjqueryIssues Posts: 9Questions: 2Answers: 0
    Hi Allan,

    Can you please confirm which jquery and jquery dataTable version to be used for table buttons to work?

    Thanks
This discussion has been closed.