TableTools, why is it not working?
TableTools, why is it not working?
I have tried various of settings but it does not work.
According to the Debug bookmarklet results I have TableTools enabled.
I tried following this guide:
https://datatables.net/release-datatables/extras/TableTools/bootstrap.html
also tried this one:
https://datatables.net/release-datatables/extras/TableTools/alt_init.html
but nothing seems to work, i dont know what I am missing.
Here is my code:
[code]
$(document).ready(function() {
var oTable = $('#sales').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bDeferRender": true,
"bSortClasses": false,
"aaSorting":[[0, "desc"]],
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": 'Save ',
"aButtons": [ "csv", "xls", "pdf" ]
}
]
},
"sPaginationType": "bootstrap",
"oScroller": {
"loadingIndicator": false
},
"sAjaxSource": "datatablesconnect.php",
"fnServerData" : function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "bekraftat", "value": "<?php echo isset( $_GET['bekraftat'] ) ? "nej" : ''; ?>" } )
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );},
"oLanguage": {
"sUrl": "datatables/media/language/sv.txt"
},
"aoColumnDefs": [
{
"bVisible": false,
"aTargets": [ 6 ]
},
{
"fnRender": function ( oObj ) {
return '';
},
"aTargets": [ 7 ]
},
{
"fnRender": function ( oObj ) {
return '';
},
"aTargets": [ 8 ]
}
]
} );
$("thead input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("thead input").index(this) );
} );
/*
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
* the footer
*/
$("thead input").each( function (i) {
asInitVals[i] = this.value;
} );
$("thead input").focus( function () {
if ( this.className == "search_init" )
{
this.className = "";
this.value = "";
}
} );
$("thead input").blur( function (i) {
if ( this.value == "" )
{
this.className = "search_init";
this.value = asInitVals[$("thead input").index(this)];
}
} );
} );
[/code]
According to the Debug bookmarklet results I have TableTools enabled.
I tried following this guide:
https://datatables.net/release-datatables/extras/TableTools/bootstrap.html
also tried this one:
https://datatables.net/release-datatables/extras/TableTools/alt_init.html
but nothing seems to work, i dont know what I am missing.
Here is my code:
[code]
$(document).ready(function() {
var oTable = $('#sales').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bDeferRender": true,
"bSortClasses": false,
"aaSorting":[[0, "desc"]],
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": 'Save ',
"aButtons": [ "csv", "xls", "pdf" ]
}
]
},
"sPaginationType": "bootstrap",
"oScroller": {
"loadingIndicator": false
},
"sAjaxSource": "datatablesconnect.php",
"fnServerData" : function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "bekraftat", "value": "<?php echo isset( $_GET['bekraftat'] ) ? "nej" : ''; ?>" } )
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );},
"oLanguage": {
"sUrl": "datatables/media/language/sv.txt"
},
"aoColumnDefs": [
{
"bVisible": false,
"aTargets": [ 6 ]
},
{
"fnRender": function ( oObj ) {
return '';
},
"aTargets": [ 7 ]
},
{
"fnRender": function ( oObj ) {
return '';
},
"aTargets": [ 8 ]
}
]
} );
$("thead input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("thead input").index(this) );
} );
/*
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
* the footer
*/
$("thead input").each( function (i) {
asInitVals[i] = this.value;
} );
$("thead input").focus( function () {
if ( this.className == "search_init" )
{
this.className = "";
this.value = "";
}
} );
$("thead input").blur( function (i) {
if ( this.value == "" )
{
this.className = "search_init";
this.value = asInitVals[$("thead input").index(this)];
}
} );
} );
[/code]
This discussion has been closed.
Replies
Allan