Tabletools에는 _fnPrintEnd
이라는 여기에 도움이되는 '개인적인'방법이 있습니다.이 방법을 사용할 수 있습니다. 클릭만으로 sMessage
에 무언가를 추가하고 이벤트를 바인딩해야합니다.
Here's a demo
$(document).ready(function() {
var oTable = $('#example').dataTable();
var oTableTools = new TableTools(oTable, {
"aButtons": [{
"sExtends": "print",
"sMessage": '<div class="datatables-print-msg">' +
'<a class="btn close-print" href="#">Close print view</a>' +
'</div>'
}]
});
// Inject the tabletools HTML before the table
oTable.before(oTableTools.dom.container);
// Bind our close function to the button we will prepend
// must use delegate because the button won't exist yet.
$(document).delegate(".datatables-print-msg .close-print", "click", function (e) {
e.preventDefault();
oTableTools._fnPrintEnd(e);
});
});
출처
2013-07-02 07:57:39
Wil