diff --git a/pagination/dynamic_pagination.js b/pagination/dynamic_pagination.js new file mode 100644 index 00000000..a3f9bbb2 --- /dev/null +++ b/pagination/dynamic_pagination.js @@ -0,0 +1,224 @@ +/** + * This pagination plug-in provides multiple navigation types ( Select box, input, or basic navigation ) + * + * To set the limits: + * + * 'maxNormalPages' is used for the maximum pages in normal mode + * 'maxSelectPages' is used for the selectbox mode + * + * @name Dynamic input,select list + * @summary Show a `dt-tag select` `dt-tag input` list of pages the user can pick from. + * @author Frank van Os + * + * @example + * $(document).ready(function() { + * $('#example').dataTable( { + * "sPaginationType": "dynamic_pagination" + * } ); + * } ); + */ +$.fn.dataTableExt.oPagination.dynamic_pagination = { + 'maxNormalPages': 10, + 'maxSelectPages': 20, + 'bootstrapTooltip': false, + 'fnClickHandler': function(e) { + var fnCallbackDraw = e.data.fnCallbackDraw, + oSettings = e.data.oSettings, + sPage = e.data.sPage; + + if ($(this).is(':disabled')) { + return false; + } + + oSettings.oApi._fnPageChange(oSettings, sPage); + fnCallbackDraw(oSettings); + + return true; + }, + /* + * Function: oPagination.dynamic_pagination.fnInit + * Purpose: Initalise dom elements required for pagination with listbox input + * Returns: - + * Inputs: object:oSettings - dataTables settings object + * node:nPaging - the DIV which contains this pagination control + * function:fnCallbackDraw - draw function which must be called on update + */ + "fnInit": function (oSettings, nPaging, fnCallbackDraw) { + + if (oSettings.sTableId !== '') { + $(nPaging).attr('id', oSettings.sTableId + '_paginate'); + } + + var oClasses = oSettings.oClasses, + oLang = oSettings.oLanguage.oPaginate; + + var PagingHolder = $('