Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82001

Trouble optimizing Datatables with DT_bootstrap.js or any datatables plugin

$
0
0
I was curious if anyone else has run into a similar situation. I'm currently implementing an application that's making use of jquery.dataTables.js, DT_bootstrap.js, and dataTables.fnReloadAjax. Everything was great until I ran my optimizer to combine everything into one js file, at which point Datatables started exploding. Backing up, I simply made one js file with the 3 datatables js files concatenated into one and it looks like none of the $.fn.DataTable objects are available when code is appended to jquery.dataTables.js. That this only seems to work when they're included as separate files, which seems odd to me.

For reference here are the errors I'm seeing

        // .... end of jquery.dataTables.js

         // jQuery aliases
	$.fn.DataTable = DataTable;
	$.fn.dataTable = DataTable;
	$.fn.dataTableSettings = DataTable.settings;
	$.fn.dataTableExt = DataTable.ext;
}));

}(window, document));

// ... begining of DT_bootstrap.js
/* Set the defaults for DataTables initialisation */
$.extend( true, $.fn.dataTable.defaults, {
	"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
	"sPaginationType": "bootstrap",
	"oLanguage": {
		"sLengthMenu": "_MENU_ records per page"
	}
} );

which produces the error

TypeError: Cannot read property 'defaults' of undefined

Viewing all articles
Browse latest Browse all 82001

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>