[Solved] Getting only print button.

[Solved] Getting only print button.

anjibmananjibman Posts: 115Questions: 10Answers: 0
edited November 2011 in General
Hi All,

I am looking a way to add only print button on the DataTable with only printer icon. I don't want to have "Print" text in button also.

I have following code and its not working.

[code]
$(document).ready(function(){

var oTable = $('#transaction').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
"aaSorting": [[0, 'desc']],
"bProcessing": true
});

var oTableTools = new TableTools( oTable, {
"aButtons": [
{
"type" : "print",
"sButtonText": " ",
"sToolTip": "Print"

}
]
});

$('#transaction_wrapper').before( oTableTools.dom.container );

});
[/code]

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Rather than:

    [code]
    "type" : "print",
    [/code]

    you want:

    [code]
    "sExtends" : "print",
    [/code]

    Then it should all work :-)

    Allan
  • anjibmananjibman Posts: 115Questions: 10Answers: 0
    With this code
    [code]
    $(document).ready(function(){

    var oTable = $('#transaction').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "iDisplayLength": 25,
    "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
    "aaSorting": [[0, 'desc']],
    "bProcessing": true
    });

    var oTableTools = new TableTools( oTable, {
    "aButtons": [ {
    "type": "print",
    "sButtonText": " ",
    "sToolTip": "Print"
    }]


    });

    $('#transaction_wrapper').before( oTableTools.dom.container );


    });
    [/code]

    I am getting error message "TableTools: Warning - unknown button type: undefined"
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    http://images.cheezburger.com/completestore/2011/9/7/a335b3b2-81d0-416e-9ab1-3ac05b037060.jpg
  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    "type" is not a valid option for TableTools buttons - you want "sExtends" like I noted in my previous post.

    Allan
This discussion has been closed.