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 */
$.extend( true, $.fn.dataTable.defaults, {
"sDom":
$.extend( true, DataTable.defaults, {
dom:
"<'row'<'col-xs-6'l><'col-xs-6'f>r>"+
"t"+
"<'row'<'col-xs-6'i><'col-xs-6'p>>",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
renderer: 'bootstrap'
} );
/* Default class modification */
$.extend( $.fn.dataTableExt.oStdClasses, {
"sWrapper": "dataTables_wrapper form-inline",
"sFilterInput": "form-control input-sm",
"sLengthSelect": "form-control input-sm"
$.extend( DataTable.ext.classes, {
sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
sFilterInput: "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++ ) {
button = buttons[i];
/* Bootstrap paging button renderer */
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 ) ) {
attach( container, button );
}
else {
btnDisplay = '';
btnClass = '';
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
);
}
}
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 );
}
};
attach(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
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 )
};
};
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
button = buttons[i];
/* 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).append(
'<ul class="pagination">'+
'<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
'<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
'</ul>'
);
var els = $('a', nPaging);
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
},
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
if ( oPaging.iTotalPages < iListLength) {
iStart = 1;
iEnd = oPaging.iTotalPages;
}
else if ( oPaging.iPage <= iHalf ) {
iStart = 1;
iEnd = iListLength;
} else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
iStart = oPaging.iTotalPages - iListLength + 1;
iEnd = oPaging.iTotalPages;
} else {
iStart = oPaging.iPage - iHalf + 1;
iEnd = iStart + iListLength - 1;
if ( $.isArray( button ) ) {
attach( container, button );
}
else {
btnDisplay = '';
btnClass = '';
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;
}
for ( i=0, ien=an.length ; i<ien ; i++ ) {
// Remove the middle elements
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
// Add the new list items and their event handlers
for ( j=iStart ; j<=iEnd ; j++ ) {
sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
$('<li '+sClass+'><a href="#">'+j+'</a></li>')
.insertBefore( $('li:last', an[i])[0] )
.bind('click', function (e) {
e.preventDefault();
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
fnDraw( oSettings );
} );
}
// Add / remove disabled classes from the static elements
if ( oPaging.iPage === 0 ) {
$('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');
}
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(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
buttons
);
};
/*
* TableTools Bootstrap compatibility
* Required TableTools 2.1+
*/
if ( $.fn.DataTable.TableTools ) {
if ( DataTable.TableTools ) {
// 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",
"buttons": {
"normal": "btn btn-default",
@ -239,8 +155,8 @@ if ( $.fn.DataTable.TableTools ) {
}
} );
// Have the collection use a bootstrap compatible dropdown
$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
// Have the collection use a bootstrap compatible drop down
$.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
"collection": {
"container": "ul",
"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 */
$.extend( true, $.fn.dataTable.defaults, {
"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];
/*! DataTables Foundation integration
* ©2011-2014 SpryMedia Ltd - datatables.net/license
*/
if ( $.isArray( button ) ) {
attach( container, button );
}
else {
btnDisplay = '';
btnClass = '';
/**
* DataTables integration for Foundation. This requires Foundation 5 and
* DataTables 1.10 or newer.
*
* This file sets the defaults and adds options to DataTables to style its
* controls using Foundation. See http://datatables.net/manual/styling/foundation
* for further information.
*/
(function(window, document, undefined){
switch ( button ) {
case 'ellipsis':
btnDisplay = '&hellip;';
btnClass = 'unavailable';
break;
var factory = function( $, DataTable ) {
"use strict";
case 'first':
btnDisplay = lang.sFirst;
btnClass = button + (page > 0 ?
'' : ' unavailable');
break;
case 'previous':
btnDisplay = lang.sPrevious;
btnClass = button + (page > 0 ?
'' : ' unavailable');
break;
$.extend( DataTable.ext.classes, {
sWrapper: "dataTables_wrapper dt-foundation"
} );
case 'next':
btnDisplay = lang.sNext;
btnClass = button + (page < pages-1 ?
'' : ' unavailable');
break;
case 'last':
btnDisplay = lang.sLast;
btnClass = button + (page < pages-1 ?
'' : ' unavailable');
break;
/* Set the defaults for DataTables initialisation */
$.extend( true, DataTable.defaults, {
dom:
"<'row'<'small-6 columns'l><'small-6 columns'f>r>"+
"t"+
"<'row'<'small-6 columns'i><'small-6 columns'p>>",
renderer: 'foundation'
} );
default:
btnDisplay = button + 1;
btnClass = page === button ?
'current' : '';
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 );
/* Page button renderer */
DataTable.ext.renderer.pageButton.foundation = 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;
settings.oApi._fnBindAction(
node, {action: button}, clickHandler
);
}
}
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 );
}
};
attach(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
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 )
};
};
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
button = buttons[i];
/* Bootstrap style pagination control */
$.extend( $.fn.dataTableExt.oPagination, {
"foundation": {
"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).append(
'<ul class="pagination">'+
'<li class="prev arrow unavailable"><a href="">&laquo;</a></li>'+
'<li class="next arrow unavailable"><a href="">&raquo;</a></li>'+
'</ul>'
);
var els = $('a', nPaging);
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
},
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var pages = [];
var i, ien, klass, host;
// This could use some improving - however, see
// https://github.com/DataTables/DataTables/issues/163 - this will
// be changing in the near future, so not much point in doing too
// much just now
if ( oPaging.iTotalPages <= 6 ) {
for ( i=0 ; i<oPaging.iTotalPages ; i++ ) {
pages.push( i );
}
}
else {
// Current page
pages.push( oPaging.iPage );
// 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 );
}
if ( $.isArray( button ) ) {
attach( container, button );
}
else {
btnDisplay = '';
btnClass = '';
switch ( button ) {
case 'ellipsis':
btnDisplay = '&hellip;';
btnClass = 'unavailable';
break;
case 'first':
btnDisplay = lang.sFirst;
btnClass = button + (page > 0 ?
'' : ' unavailable');
break;
case 'previous':
btnDisplay = lang.sPrevious;
btnClass = button + (page > 0 ?
'' : ' unavailable');
break;
case 'next':
btnDisplay = lang.sNext;
btnClass = button + (page < pages-1 ?
'' : ' unavailable');
break;
case 'last':
btnDisplay = lang.sLast;
btnClass = button + (page < pages-1 ?
'' : ' unavailable');
break;
default:
btnDisplay = button + 1;
btnClass = page === button ?
'current' : '';
break;
}
for ( i=0, ien=an.length ; i<ien ; i++ ) {
// Remove the middle elements
host = an[i];
$('li:gt(0)', host).filter(':not(:last)').remove();
// Add the new list items and their event handlers
$.each( pages, function( i, page ) {
klass = page === null ? 'unavailable' :
page === oPaging.iPage ? 'current' : '';
$('<li class="'+klass+'"><a href="">'+(page===null? '&hellip;' : page+1)+'</a></li>')
.insertBefore( $('li:last', host) )
.bind('click', function (e) {
e.preventDefault();
var pageNum = parseInt($('a', this).text(),10);
if ( ! isNaN(pageNum)) {
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 ( 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 );
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
$('li:last', host).addClass('unavailable');
} else {
$('li:last', host).removeClass('unavailable');
}
settings.oApi._fnBindAction(
node, {action: button}, clickHandler
);
}
}
}
} );
}
};
attach(
$(host).empty().html('<ul class="pagination"/>').children('ul'),
buttons
);
};
/*
* TableTools Foundation compatibility
* Required TableTools 2.1+
*/
if ( $.fn.DataTable.TableTools ) {
if ( DataTable.TableTools ) {
// 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",
"buttons": {
"normal": "button",
@ -279,7 +150,7 @@ if ( $.fn.DataTable.TableTools ) {
} );
// Have the collection use a bootstrap compatible dropdown
$.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
$.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
"collection": {
"container": "ul",
"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 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, {
"sWrapper": "dataTables_wrapper dt-jqueryui",
/* Full numbers paging buttons */
"sPageButton": "fg-button ui-button ui-state-default",
"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
var noSortAppliedClass = sort_prefix+'carat-2-n-s';
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