/*! * DataTables jquery plugin (for Twitter Bootstrap style) * * Copyright 2012 * DataTables is dual licensed under the GPL v2 license or a BSD (3-point) license. * http://www.datatables.net * http://www.datatables.net/blog/Twitter_Bootstrap_2 * */ /* Table initialisation */ $(document).ready(function() { $('#dataTable').dataTable( { "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], "aoColumnDefs": [ { "bSortable": false, "aTargets": [ -1 ] } ], "oLanguage": { "sLengthMenu": gettext("_MENU_ entries per page"), "sSearch": gettext("Search:"), "sInfo": gettext("Showing _START_ to _END_ of _TOTAL_ entries"), "sInfoEmpty": gettext("Showing 0 entries"), "sInfoFiltered": gettext("(filtered from _MAX_ total entries)"), "sZeroRecords": gettext("No matching records found"), "oPaginate": { "sFirst": gettext("First"), "sLast": gettext("Last"), "sNext": gettext("Next"), "sPrevious": gettext("Previous"), } } } ); } ); /* 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", } ); /* Default class modification */ $.extend( $.fn.dataTableExt.oStdClasses, { "sWrapper": "dataTables_wrapper form-inline" } ); /* API method to get paging information */ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) { return { "iStart": oSettings._iDisplayStart, "iEnd": oSettings.fnDisplayEnd(), "iLength": oSettings._iDisplayLength, "iTotal": oSettings.fnRecordsTotal(), "iFilteredTotal": oSettings.fnRecordsDisplay(), "iPage": oSettings._iDisplayLength === -1 ? 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), "iTotalPages": oSettings._iDisplayLength === -1 ? 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) }; }; /* Bootstrap style pagination control */ $.extend( $.fn.dataTableExt.oPagination, { "bootstrap": { "fnInit": function( oSettings, nPaging, fnDraw ) { var oLang = oSettings.oLanguage.oPaginate; var fnClickHandler = function ( e ) { e.preventDefault(); if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) { fnDraw( oSettings ); } }; $(nPaging).addClass('pagination').append( '