tabletools print

tabletools print

remsyremsy Posts: 10Questions: 0Answers: 0
edited February 2011 in TableTools
Hi. Is it possible to print preview in another browser window/tab? People tend to hit the back button instead of ESC to leave print preview mode.

thanks

Replies

  • KhristKhrist Posts: 3Questions: 0Answers: 0
    Hi. I would like to do the same thing, but without modifying the TableTools.js I don't see any option.

    If somebody have a clue.

    ( I'm looking at the way of putting a button at the top/bottom of my tab and instead of pressing esc press this button )



    ps: sorry for my (bad) english.
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    There isn't an option for this in TableTools at the moment - although it is a good idea. Added to the list of future enhancements.

    Allan
  • KhristKhrist Posts: 3Questions: 0Answers: 0
    Thanks to answer, by the way I've done it, in my .jsp I put :

    [code]


    Retour

    [/code]

    And in a .js include I've put :

    [code]
    var printEnd = function(datatableName, bouttonDiv) {
    /* TableTools.fnGetInstance('traitement')._fnPrintEnd(e); */
    var that = TableTools.fnGetInstance(datatableName);
    var oSetDT = TableTools.fnGetInstance(datatableName).s.dt;
    var oSetPrint = TableTools.fnGetInstance(datatableName).s.print;
    var oDomPrint = TableTools.fnGetInstance(datatableName).dom.print;

    /* Show all hidden nodes */
    TableTools.fnGetInstance(datatableName)._fnPrintShowNodes();

    /* Restore DataTables' scrolling */
    if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
    {
    TableTools.fnGetInstance(datatableName)._fnPrintScrollEnd();
    }

    /* Restore the scroll */
    window.scrollTo( 0, oSetPrint.saveScroll );

    /* Drop the print message */
    if ( oDomPrint.message !== null )
    {
    document.body.removeChild( oDomPrint.message );
    oDomPrint.message = null;
    }

    /* Styling class */
    J(document.body).removeClass( 'DTTT_Print' );

    /* Restore the table length */
    oSetDT._iDisplayStart = oSetPrint.saveStart;
    oSetDT._iDisplayLength = oSetPrint.saveLength;
    oSetDT.oApi._fnCalculateEnd( oSetDT );
    oSetDT.oApi._fnDraw( oSetDT );

    J(document).unbind( "keydown", TableTools.fnGetInstance(datatableName).s.print.funcEnd );
    TableTools.fnGetInstance(datatableName).s.print.funcEnd = null;
    J('#' + bouttonDiv).addClass("hide");
    };
    [/code]

    It's working well but if you do something to TableTool it should be better of course. Waiting for that this solution is not too bad ( and not instrusive, I've disabled the escape key manualy to keep the control on the "back div" but it should be good to put a parameter to the print method to disable de Escape key).

    Is it possible to know when you want to put the "Tab feature" in TableTools ?
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    I would like to put it in right now :-) However realistically it might be a little while - on the order of months, since i'm in the middle of working on DataTables 1.8 at the moment. You can keep up to date with the releases RSS feed: http://www.datatables.net/rss.xml , and Twitter: @DataTables .

    Allan
  • KhristKhrist Posts: 3Questions: 0Answers: 0
    Thanks, i'll stay tuned.
  • icebergiceberg Posts: 14Questions: 0Answers: 0
    edited May 2011
    Combining current post as a feature request, and this one (http://datatables.net/forums/comments.php?DiscussionID=3967) as an implementation hint, I came up with this solution. It is just a hack, should better be integrated into next version of TableTools.

    { "sExtends": "print",
    "sMessage": "Your original message"
    + " "
    }

    Regards,
    Ray
  • deepakdeepak Posts: 13Questions: 0Answers: 0
    Allan,
    Is this resolved ?


    --
    gnumonk
  • cseigelcseigel Posts: 4Questions: 0Answers: 0
    Allan - Can you update this post for us (Did it make it into DataTables 1.9.4 ?)

    Thanks!
  • majortommajortom Posts: 29Questions: 0Answers: 0
    edited August 2013
    Hey Allan. Is there any way to do this yet? Clients are getting confused as to how to get back to the previous page because the instructions disappear. Thanks
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    No - I've not yet had a chance to do this as DataTables 1.10 and Editor 1.3 are taking priority.

    Allan
This discussion has been closed.