how to exit from print screen page and open print screen in new window

how to exit from print screen page and open print screen in new window

rajmalviyarajmalviya Posts: 12Questions: 2Answers: 1

dataTable = $('#dt_basic').DataTable({
"processing": false,
"serverSide": true,"bInfo": true,"stateSave":true,
"lengthMenu": [ [10, 25, 50,-1], [10, 25, 50,"All"] ],"paging": true,
"oTableTools": {
"sSwfPath": "assets/js/plugin/datatables/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "print",
"sButtonText": "Print",
"mColumns": "visible",
"sMessage": "List<i>(press Esc to close)</i>",
},
{
"sExtends": "collection",
"sButtonText": "Export",
"aButtons": [
{
"sExtends": "csv",
"sButtonText": "CSV",
"mColumns": "visible"
},
{
"sExtends": "xls",
"sButtonText": "Excel",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sButtonText": "PDF",
"mColumns": "visible"
},
]
}
]
},
"ajax":{
url :"list/report", // json datasource
type: "post", // method , by default get
error: function(e,responseText1,responseText){ // error handling

                $("#ErrorDataTable").html('<tr><th colspan="4"><div class="alert alert-danger" style="text-align:center;"><strong>'+responseText+'</strong></div></th></tr>');
            }
         },
                    "columns": [{"data":"a"},{"data":"b"},{"data":"c"},{"data":"d"}],
        "sDom": "<'dt-toolbar'<'col-xs-12 col-sm-6'T><'col-sm-6 col-xs-12 hidden-xs'l>r>"+"t"+"<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-6'p>>",
        "autoWidth" : true,
    } );

thats my code and when i click on print button, it's open in same window but main problem is when i click on click to go back button it still not exit print screen how to resolve this problem ?
thanks

This question has an accepted answers - jump to answer

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119
    Answer ✓

    It owns in the same window but a different tab, right?

  • rajmalviyarajmalviya Posts: 12Questions: 2Answers: 1

    It's my fault, you are right.
    but how to open and exit?

  • allanallan Posts: 62,377Questions: 1Answers: 10,234 Site admin

    I don't fully understand I'm afraid. The print view will exit automatically after the print dialogue has been confirmed or dismissed.

    Allan

  • rajmalviyarajmalviya Posts: 12Questions: 2Answers: 1

    thanks allan for your response but the issue is if you don't exit print view through esc key and you press click to go back of tab than the full screen mode of print view can't exit .

  • rajmalviyarajmalviya Posts: 12Questions: 2Answers: 1

    click to go back means history back (previous page)

  • allanallan Posts: 62,377Questions: 1Answers: 10,234 Site admin

    I'm still confused sorry. Can you give me exact instructions on how to reproduce the issue?

    The back button shouldn't do anything on the print page since it is a new document.

    Allan

  • rajmalviyarajmalviya Posts: 12Questions: 2Answers: 1

    Sorry for the delay , it does not automatically call the browser's window.print() method to present the browser's print dialogue box to the end user . So how to automatically call the browser's window.print() method
    "aButtons": [
    {
    "sExtends": "print",
    "sButtonText": "Print",
    "mColumns": "visible",
    "sMessage": "List<i>(press Esc to close)</i>",
    },

  • rajmalviyarajmalviya Posts: 12Questions: 2Answers: 1

    By the way got the answers for history back (previous page)

    window.onhashchange = function(e) {
    $("body").removeClass("DTTT_Print");
    $("#header").css({"display":"block"});
    $("#left-panel").css({"display":"block"});
    $("#page-footer").css({"display":"block"});
    }

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    @allan I duplicated what he is talking about.

    When I run this code, the page opens up and the print screen pops right up.

    $(document).ready(function() {
        $('#example').DataTable( {
            dom: 'Bfrtip',
            buttons: ['print']
        } );
    } );
    

    However, when I run the print button in an extend, the page opens but the popup print screen does not.

    $(document).ready(function() {
        $('#example').DataTable( {
            dom: 'Bfrtip',
            buttons: [{text:"pm",
                extend:'print'}
            ]
        } );
    } );
    
This discussion has been closed.