Updates for the integration files:

* All are AMD and CommonJS compatible now
* Each adds a `dt-*` class to the wrapper element for conditional
  styling
* DataTables 1.10+ only now
pull/73/head
Allan Jardine 11 years ago
parent 48930f65dc
commit 427ef66304

@ -1,224 +1,140 @@
/*! DataTables Bootstrap integration
* ©2011-2014 SpryMedia Ltd - datatables.net/license
*/
/**
* DataTables integration for Bootstrap 3. This requires Bootstrap 3 and
* DataTables 1.10 or newer.
*
* This file sets the defaults and adds options to DataTables to style its
* controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
* for further information.
*/
(function(window, document, undefined){
var factory = function( $, DataTable ) {
"use strict";
/* Set the defaults for DataTables initialisation */ /* Set the defaults for DataTables initialisation */
$.extend( true, $.fn.dataTable.defaults, { $.extend( true, DataTable.defaults, {
"sDom": dom:
"<'row'<'col-xs-6'l><'col-xs-6'f>r>"+ "<'row'<'col-xs-6'l><'col-xs-6'f>r>"+
"t"+ "t"+
"<'row'<'col-xs-6'i><'col-xs-6'p>>", "<'row'<'col-xs-6'i><'col-xs-6'p>>",
"oLanguage": { renderer: 'bootstrap'
"sLengthMenu": "_MENU_ records per page"
}
} ); } );
/* Default class modification */ /* Default class modification */
$.extend( $.fn.dataTableExt.oStdClasses, { $.extend( DataTable.ext.classes, {
"sWrapper": "dataTables_wrapper form-inline", sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
"sFilterInput": "form-control input-sm", sFilterInput: "form-control input-sm",
"sLengthSelect": "form-control input-sm" sLengthSelect: "form-control input-sm"
} ); } );
// In 1.10 we use the pagination renderers to draw the Bootstrap paging,
// rather than custom plug-in
if ( $.fn.dataTable.Api ) {
$.fn.dataTable.defaults.renderer = 'bootstrap';
$.fn.dataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
var api = new $.fn.dataTable.Api( settings );
var classes = settings.oClasses;
var lang = settings.oLanguage.oPaginate;
var btnDisplay, btnClass;
var attach = function( container, buttons ) {
var i, ien, node, button;
var clickHandler = function ( e ) {
e.preventDefault();
if ( e.data.action !== 'ellipsis' ) {
api.page( e.data.action ).draw( false );
}
};
for ( i=0, ien=buttons.length ; i<ien ; i++ ) { /* Bootstrap paging button renderer */
button = buttons[i]; DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
var api = new DataTable.Api( settings );
var classes = settings.oClasses;
var lang = settings.oLanguage.oPaginate;
var btnDisplay, btnClass;
if ( $.isArray( button ) ) { var attach = function( container, buttons ) {
attach( container, button ); var i, ien, node, button;
} var clickHandler = function ( e ) {
else { e.preventDefault();
btnDisplay = ''; if ( e.data.action !== 'ellipsis' ) {
btnClass = ''; api.page( e.data.action ).draw( false );
switch ( button ) {
case 'ellipsis':
btnDisplay = '&hellip;';
btnClass = 'disabled';
break;
case 'first':
btnDisplay = lang.sFirst;
btnClass = button + (page > 0 ?
'' : ' disabled');
break;
case 'previous':
btnDisplay = lang.sPrevious;
btnClass = button + (page > 0 ?
'' : ' disabled');
break;
case 'next':
btnDisplay = lang.sNext;
btnClass = button + (page < pages-1 ?
'' : ' disabled');
break;
case 'last':
btnDisplay = lang.sLast;
btnClass = button + (page < pages-1 ?
'' : ' disabled');
break;
default:
btnDisplay = button + 1;
btnClass = page === button ?
'active' : '';
break;
}
if ( btnDisplay ) {
node = $('<li>', {
'class': classes.sPageButton+' '+btnClass,
'aria-controls': settings.sTableId,
'tabindex': settings.iTabIndex,
'id': idx === 0 && typeof button === 'string' ?
settings.sTableId +'_'+ button :
null
} )
.append( $('<a>', {
'href': '#'
} )
.html( btnDisplay )
)
.appendTo( container );
settings.oApi._fnBindAction(
node, {action: button}, clickHandler
);
}
}
} }
}; };
attach( for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
$(host).empty().html('<ul class="pagination"/>').children('ul'), button = buttons[i];
buttons
);
}
}
else {
// Integration for 1.9-
$.fn.dataTable.defaults.sPaginationType = 'bootstrap';
/* 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 */ if ( $.isArray( button ) ) {
$.extend( $.fn.dataTableExt.oPagination, { attach( container, button );
"bootstrap": { }
"fnInit": function( oSettings, nPaging, fnDraw ) { else {
var oLang = oSettings.oLanguage.oPaginate; btnDisplay = '';
var fnClickHandler = function ( e ) { btnClass = '';
e.preventDefault();
if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) { switch ( button ) {
fnDraw( oSettings ); case 'ellipsis':
} btnDisplay = '&hellip;';
}; btnClass = 'disabled';
break;
$(nPaging).append(
'<ul class="pagination">'+ case 'first':
'<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+ btnDisplay = lang.sFirst;
'<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+ btnClass = button + (page > 0 ?
'</ul>' '' : ' disabled');
); break;
var els = $('a', nPaging);
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); case 'previous':
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler ); btnDisplay = lang.sPrevious;
}, btnClass = button + (page > 0 ?
'' : ' disabled');
"fnUpdate": function ( oSettings, fnDraw ) { break;
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo(); case 'next':
var an = oSettings.aanFeatures.p; btnDisplay = lang.sNext;
var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2); btnClass = button + (page < pages-1 ?
'' : ' disabled');
if ( oPaging.iTotalPages < iListLength) { break;
iStart = 1;
iEnd = oPaging.iTotalPages; case 'last':
} btnDisplay = lang.sLast;
else if ( oPaging.iPage <= iHalf ) { btnClass = button + (page < pages-1 ?
iStart = 1; '' : ' disabled');
iEnd = iListLength; break;
} else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
iStart = oPaging.iTotalPages - iListLength + 1; default:
iEnd = oPaging.iTotalPages; btnDisplay = button + 1;
} else { btnClass = page === button ?
iStart = oPaging.iPage - iHalf + 1; 'active' : '';
iEnd = iStart + iListLength - 1; break;
} }
for ( i=0, ien=an.length ; i<ien ; i++ ) { if ( btnDisplay ) {
// Remove the middle elements node = $('<li>', {
$('li:gt(0)', an[i]).filter(':not(:last)').remove(); 'class': classes.sPageButton+' '+btnClass,
'aria-controls': settings.sTableId,
// Add the new list items and their event handlers 'tabindex': settings.iTabIndex,
for ( j=iStart ; j<=iEnd ; j++ ) { 'id': idx === 0 && typeof button === 'string' ?
sClass = (j==oPaging.iPage+1) ? 'class="active"' : ''; settings.sTableId +'_'+ button :
$('<li '+sClass+'><a href="#">'+j+'</a></li>') null
.insertBefore( $('li:last', an[i])[0] ) } )
.bind('click', function (e) { .append( $('<a>', {
e.preventDefault(); 'href': '#'
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength; } )
fnDraw( oSettings ); .html( btnDisplay )
} ); )
} .appendTo( container );
// Add / remove disabled classes from the static elements settings.oApi._fnBindAction(
if ( oPaging.iPage === 0 ) { node, {action: button}, clickHandler
$('li:first', an[i]).addClass('disabled'); );
} else {
$('li:first', an[i]).removeClass('disabled');
}
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
$('li:last', an[i]).addClass('disabled');
} else {
$('li:last', an[i]).removeClass('disabled');
}
} }
} }
} }
} ); };
}
attach(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
buttons
);
};
/* /*
* TableTools Bootstrap compatibility * TableTools Bootstrap compatibility
* Required TableTools 2.1+ * Required TableTools 2.1+
*/ */
if ( $.fn.DataTable.TableTools ) { if ( DataTable.TableTools ) {
// Set the classes that TableTools uses to something suitable for Bootstrap // Set the classes that TableTools uses to something suitable for Bootstrap
$.extend( true, $.fn.DataTable.TableTools.classes, { $.extend( true, DataTable.TableTools.classes, {
"container": "DTTT btn-group", "container": "DTTT btn-group",
"buttons": { "buttons": {
"normal": "btn btn-default", "normal": "btn btn-default",
@ -239,8 +155,8 @@ if ( $.fn.DataTable.TableTools ) {
} }
} ); } );
// Have the collection use a bootstrap compatible dropdown // Have the collection use a bootstrap compatible drop down
$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { $.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
"collection": { "collection": {
"container": "ul", "container": "ul",
"button": "li", "button": "li",
@ -249,3 +165,22 @@ if ( $.fn.DataTable.TableTools ) {
} ); } );
} }
}; // /factory
// Define as an AMD module if possible
if ( typeof define === 'function' && define.amd ) {
define( ['jquery', 'datatables'], factory );
}
else if ( typeof exports === 'object' ) {
// Node/CommonJS
factory( require('jquery'), require('datatables') );
}
else if ( jQuery ) {
// Otherwise simply initialise as normal, stopping multiple evaluation
factory( jQuery, jQuery.fn.dataTable );
}
})(window, document);

@ -1,266 +1,137 @@
/* Set the defaults for DataTables initialisation */ /*! DataTables Foundation integration
$.extend( true, $.fn.dataTable.defaults, { * ©2011-2014 SpryMedia Ltd - datatables.net/license
"sDom": */
"<'row'<'small-6 columns'l><'small-6 columns'f>r>"+
"t"+
"<'row'<'small-6 columns'i><'small-6 columns'p>>",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
} );
// In 1.10 we use the pagination renderers to draw the Bootstrap paging,
// rather than custom plug-in
if ( $.fn.dataTable.Api ) {
$.fn.dataTable.defaults.renderer = 'foundation';
$.fn.dataTable.ext.renderer.pageButton.foundation = function ( settings, host, idx, buttons, page, pages ) {
var api = new $.fn.dataTable.Api( settings );
var classes = settings.oClasses;
var lang = settings.oLanguage.oPaginate;
var btnDisplay, btnClass;
var attach = function( container, buttons ) {
var i, ien, node, button;
var clickHandler = function ( e ) {
e.preventDefault();
if ( e.data.action !== 'ellipsis' ) {
api.page( e.data.action ).draw( false );
}
};
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
button = buttons[i];
if ( $.isArray( button ) ) { /**
attach( container, button ); * DataTables integration for Foundation. This requires Foundation 5 and
} * DataTables 1.10 or newer.
else { *
btnDisplay = ''; * This file sets the defaults and adds options to DataTables to style its
btnClass = ''; * controls using Foundation. See http://datatables.net/manual/styling/foundation
* for further information.
*/
(function(window, document, undefined){
switch ( button ) { var factory = function( $, DataTable ) {
case 'ellipsis': "use strict";
btnDisplay = '&hellip;';
btnClass = 'unavailable';
break;
case 'first':
btnDisplay = lang.sFirst;
btnClass = button + (page > 0 ?
'' : ' unavailable');
break;
case 'previous': $.extend( DataTable.ext.classes, {
btnDisplay = lang.sPrevious; sWrapper: "dataTables_wrapper dt-foundation"
btnClass = button + (page > 0 ? } );
'' : ' unavailable');
break;
case 'next':
btnDisplay = lang.sNext;
btnClass = button + (page < pages-1 ?
'' : ' unavailable');
break;
case 'last': /* Set the defaults for DataTables initialisation */
btnDisplay = lang.sLast; $.extend( true, DataTable.defaults, {
btnClass = button + (page < pages-1 ? dom:
'' : ' unavailable'); "<'row'<'small-6 columns'l><'small-6 columns'f>r>"+
break; "t"+
"<'row'<'small-6 columns'i><'small-6 columns'p>>",
renderer: 'foundation'
} );
default:
btnDisplay = button + 1;
btnClass = page === button ?
'current' : '';
break;
}
if ( btnDisplay ) { /* Page button renderer */
node = $('<li>', { DataTable.ext.renderer.pageButton.foundation = function ( settings, host, idx, buttons, page, pages ) {
'class': classes.sPageButton+' '+btnClass, var api = new DataTable.Api( settings );
'aria-controls': settings.sTableId, var classes = settings.oClasses;
'tabindex': settings.iTabIndex, var lang = settings.oLanguage.oPaginate;
'id': idx === 0 && typeof button === 'string' ? var btnDisplay, btnClass;
settings.sTableId +'_'+ button :
null
} )
.append( $('<a>', {
'href': '#'
} )
.html( btnDisplay )
)
.appendTo( container );
settings.oApi._fnBindAction( var attach = function( container, buttons ) {
node, {action: button}, clickHandler var i, ien, node, button;
); var clickHandler = function ( e ) {
} e.preventDefault();
} if ( e.data.action !== 'ellipsis' ) {
api.page( e.data.action ).draw( false );
} }
}; };
attach( for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
$(host).empty().html('<ul class="pagination"/>').children('ul'), button = buttons[i];
buttons
);
}
}
else {
// Integration for 1.9-
$.fn.dataTable.defaults.sPaginationType = 'foundation';
/* 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 */ if ( $.isArray( button ) ) {
$.extend( $.fn.dataTableExt.oPagination, { attach( container, button );
"foundation": { }
"fnInit": function( oSettings, nPaging, fnDraw ) { else {
var oLang = oSettings.oLanguage.oPaginate; btnDisplay = '';
var fnClickHandler = function ( e ) { btnClass = '';
e.preventDefault();
if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) { switch ( button ) {
fnDraw( oSettings ); case 'ellipsis':
} btnDisplay = '&hellip;';
}; btnClass = 'unavailable';
break;
$(nPaging).append(
'<ul class="pagination">'+ case 'first':
'<li class="prev arrow unavailable"><a href="">&laquo;</a></li>'+ btnDisplay = lang.sFirst;
'<li class="next arrow unavailable"><a href="">&raquo;</a></li>'+ btnClass = button + (page > 0 ?
'</ul>' '' : ' unavailable');
); break;
var els = $('a', nPaging);
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); case 'previous':
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler ); btnDisplay = lang.sPrevious;
}, btnClass = button + (page > 0 ?
'' : ' unavailable');
"fnUpdate": function ( oSettings, fnDraw ) { break;
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo(); case 'next':
var an = oSettings.aanFeatures.p; btnDisplay = lang.sNext;
var pages = []; btnClass = button + (page < pages-1 ?
var i, ien, klass, host; '' : ' unavailable');
break;
// This could use some improving - however, see
// https://github.com/DataTables/DataTables/issues/163 - this will case 'last':
// be changing in the near future, so not much point in doing too btnDisplay = lang.sLast;
// much just now btnClass = button + (page < pages-1 ?
if ( oPaging.iTotalPages <= 6 ) { '' : ' unavailable');
for ( i=0 ; i<oPaging.iTotalPages ; i++ ) { break;
pages.push( i );
} default:
} btnDisplay = button + 1;
else { btnClass = page === button ?
// Current page 'current' : '';
pages.push( oPaging.iPage ); break;
// After current page
var pagesAfter = oPaging.iPage + 2 >= oPaging.iTotalPages ?
oPaging.iTotalPages :
oPaging.iPage + 2;
for ( i=oPaging.iPage+1 ; i<pagesAfter ; i++ ) {
pages.push( i );
}
// After gap
if ( pagesAfter < oPaging.iTotalPages-2 ) {
pages.push( null );
}
// End
if ( $.inArray( oPaging.iTotalPages-2, pages ) === -1 && oPaging.iPage < oPaging.iTotalPages-2 ) {
pages.push( oPaging.iTotalPages-2 );
}
if ( $.inArray( oPaging.iTotalPages-1, pages ) === -1 ) {
pages.push( oPaging.iTotalPages-1 );
}
// Pages before
var pagesBefore = oPaging.iPage - 2 > 0 ?
oPaging.iPage - 2 :
0;
for ( i=oPaging.iPage-1 ; i>pagesBefore ; i-- ) {
pages.unshift( i );
}
// Before gap
if ( pagesBefore > 1 ) {
pages.unshift( null );
}
// Start
if ( $.inArray( 1, pages ) === -1 && oPaging.iTotalPages > 1 ) {
pages.unshift( 1 );
}
if ( $.inArray( 0, pages ) === -1 ) {
pages.unshift( 0 );
}
} }
for ( i=0, ien=an.length ; i<ien ; i++ ) { if ( btnDisplay ) {
// Remove the middle elements node = $('<li>', {
host = an[i]; 'class': classes.sPageButton+' '+btnClass,
$('li:gt(0)', host).filter(':not(:last)').remove(); 'aria-controls': settings.sTableId,
'tabindex': settings.iTabIndex,
// Add the new list items and their event handlers 'id': idx === 0 && typeof button === 'string' ?
$.each( pages, function( i, page ) { settings.sTableId +'_'+ button :
klass = page === null ? 'unavailable' : null
page === oPaging.iPage ? 'current' : ''; } )
$('<li class="'+klass+'"><a href="">'+(page===null? '&hellip;' : page+1)+'</a></li>') .append( $('<a>', {
.insertBefore( $('li:last', host) ) 'href': '#'
.bind('click', function (e) { } )
e.preventDefault(); .html( btnDisplay )
var pageNum = parseInt($('a', this).text(),10); )
if ( ! isNaN(pageNum)) { .appendTo( container );
oSettings._iDisplayStart = (pageNum-1) * oPaging.iLength;
fnDraw( oSettings );
}
} );
} );
// Add / remove disabled classes from the static elements
if ( oPaging.iPage === 0 ) {
$('li:first', host).addClass('unavailable');
} else {
$('li:first', host).removeClass('unavailable');
}
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) { settings.oApi._fnBindAction(
$('li:last', host).addClass('unavailable'); node, {action: button}, clickHandler
} else { );
$('li:last', host).removeClass('unavailable');
}
} }
} }
} }
} ); };
}
attach(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
buttons
);
};
/* /*
* TableTools Foundation compatibility * TableTools Foundation compatibility
* Required TableTools 2.1+ * Required TableTools 2.1+
*/ */
if ( $.fn.DataTable.TableTools ) { if ( DataTable.TableTools ) {
// Set the classes that TableTools uses to something suitable for Foundation // Set the classes that TableTools uses to something suitable for Foundation
$.extend( true, $.fn.DataTable.TableTools.classes, { $.extend( true, DataTable.TableTools.classes, {
"container": "DTTT button-group", "container": "DTTT button-group",
"buttons": { "buttons": {
"normal": "button", "normal": "button",
@ -279,7 +150,7 @@ if ( $.fn.DataTable.TableTools ) {
} ); } );
// Have the collection use a bootstrap compatible dropdown // Have the collection use a bootstrap compatible dropdown
$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { $.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
"collection": { "collection": {
"container": "ul", "container": "ul",
"button": "li", "button": "li",
@ -288,3 +159,22 @@ if ( $.fn.DataTable.TableTools ) {
} ); } );
} }
}; // /factory
// Define as an AMD module if possible
if ( typeof define === 'function' && define.amd ) {
define( ['jquery', 'datatables'], factory );
}
else if ( typeof exports === 'object' ) {
// Node/CommonJS
factory( require('jquery'), require('datatables') );
}
else if ( jQuery ) {
// Otherwise simply initialise as normal, stopping multiple evaluation
factory( jQuery, jQuery.fn.dataTable );
}
})(window, document);

@ -1,76 +0,0 @@
/**
* jQuery DataTables jPaginator plugin v1.0 - integration between DataTables and
* jPaginator
* by Ernani Azevedo <azevedo@intellinews.com.br>
*
* You'll need jQuery DataTables (http://datatables.net/) and jPaginator
* (http://remylab.github.com/jpaginator/) loaded before load this one.
*
* Full description is available here:
* http://www.intellinews.com.br/blog/2012/10/26/jquery-datatables-integration-with-jpaginator-4/
*
* @license GPL v3.0.
* @example
* // Initialise DataTables with jPaginator paging
* $('#example').dataTable ( {
* 'sPaginationType': 'jPaginator'
* } );
*/
// API method to get paging information (Got idea from Twitter Bootstrap plugin):
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings)
{
if ( oSettings)
{
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd (),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal (),
"iFilteredTotal": oSettings.fnRecordsDisplay (),
"iPage": Math.ceil ( oSettings._iDisplayStart / oSettings._iDisplayLength),
"iTotalPages": Math.ceil ( oSettings.fnRecordsDisplay () / oSettings._iDisplayLength)};
} else {
return {
"iStart": 0,
"iEnd": 0,
"iLength": 0,
"iTotal": 0,
"iFilteredTotal": 0,
"iPage": 0,
"iTotalPages": 0
}
}
};
// Extends DataTable to support jPaginator pagination style:
$.fn.dataTableExt.oPagination.jPaginator = {
'paginator': $('<span>').html ( '<nav id="m_left"></nav><nav id="o_left"></nav><div class="paginator_p_wrap"><div class="paginator_p_bloc"><!--<a class="paginator_p"></a>--></div></div><nav id="o_right"></nav><nav id="m_right"></nav><div class="paginator_slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"><a class="ui-slider-handle ui-state-default ui-corner-all" href="#"></a></div>'),
'fnInit': function ( oSettings, nPaging, fnCallbackDraw) {
$(nPaging).prepend ( this.paginator);
$(this.paginator).jPaginator ( {
selectedPage: 1,
nbPages: 1,
nbVisible: 6,
overBtnLeft: '#o_left',
overBtnRight: '#o_right',
maxBtnLeft: '#m_left',
maxBtnRight: '#m_right',
minSlidesForSlider: 2,
onPageClicked: function ( a, num) {
if ( num - 1 == Math.ceil ( oSettings._iDisplayStart / oSettings._iDisplayLength)) {
return;
}
oSettings._iDisplayStart = ( num - 1) * oSettings._iDisplayLength;
fnCallbackDraw ( oSettings);
}
}).addClass ( 'jPaginator');
},
'fnUpdate': function ( oSettings, fnCallbackDraw) {
if ( ! oSettings.aanFeatures.p) {
return;
}
var oPaging = oSettings.oInstance.fnPagingInfo ();
$(this.paginator).trigger ( 'reset', { nbVisible: 6, selectedPage: oPaging.iPage + 1, nbPages: oPaging.iTotalPages});
}
};

@ -1,7 +1,21 @@
/*! DataTables jQuery UI integration
* ©2011-2014 SpryMedia Ltd - datatables.net/license
*/
/**
* DataTables integration for jQuery UI. This requires jQuery UI and
* DataTables 1.10 or newer.
*
* This file sets the defaults and adds options to DataTables to style its
* controls using Bootstrap. See http://datatables.net/manual/styling/jqueryui
* for further information.
*/
(function(window, document, undefined){
var factory = function( $, DataTable ) {
"use strict";
(function(){
var DataTable = $.fn.dataTable;
var sort_prefix = 'css_right ui-icon ui-icon-'; var sort_prefix = 'css_right ui-icon ui-icon-';
var toolbar_prefix = 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-'; var toolbar_prefix = 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-';
@ -16,6 +30,8 @@ $.extend( true, DataTable.defaults, {
$.extend( DataTable.ext.classes, { $.extend( DataTable.ext.classes, {
"sWrapper": "dataTables_wrapper dt-jqueryui",
/* Full numbers paging buttons */ /* Full numbers paging buttons */
"sPageButton": "fg-button ui-button ui-state-default", "sPageButton": "fg-button ui-button ui-state-default",
"sPageButtonActive": "ui-state-disabled", "sPageButtonActive": "ui-state-disabled",
@ -44,7 +60,7 @@ $.extend( DataTable.ext.classes, {
} ); } );
$.fn.DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, classes ) { DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, classes ) {
// Calculate what the unsorted class should be // Calculate what the unsorted class should be
var noSortAppliedClass = sort_prefix+'carat-2-n-s'; var noSortAppliedClass = sort_prefix+'carat-2-n-s';
var asc = $.inArray('asc', column.asSorting) !== -1; var asc = $.inArray('asc', column.asSorting) !== -1;
@ -115,6 +131,22 @@ if ( DataTable.TableTools ) {
} ); } );
} }
}; // /factory
// Define as an AMD module if possible
if ( typeof define === 'function' && define.amd ) {
define( ['jquery', 'datatables'], factory );
}
else if ( typeof exports === 'object' ) {
// Node/CommonJS
factory( require('jquery'), require('datatables') );
}
else if ( jQuery ) {
// Otherwise simply initialise as normal, stopping multiple evaluation
factory( jQuery, jQuery.fn.dataTable );
}
}()); })(window, document);

@ -0,0 +1,15 @@
#!/bin/sh
OUT_DIR=$1
DEBUG=$2
# Change into script's own dir
cd $(dirname $0)
DT_SRC=$(dirname $(dirname $(pwd)))
DT_BUILT="${DT_SRC}/built/DataTables"
. $DT_SRC/build/include.sh
# Only copying the integration files
rsync -r integration $OUT_DIR
Loading…
Cancel
Save