40 $.fn.dataTableExt.oPagination.listbox = {
49 "fnInit":
function (oSettings, nPaging, fnCallbackDraw) {
50 var nInput = document.createElement(
'select');
51 var nPage = document.createElement(
'span');
52 var nOf = document.createElement(
'span');
53 nOf.className =
"paginate_of";
54 nPage.className =
"paginate_page";
55 if (oSettings.sTableId !==
'') {
56 nPaging.setAttribute(
'id', oSettings.sTableId +
'_paginate');
58 nInput.style.display =
"inline";
59 nPage.innerHTML =
"Page ";
60 nPaging.appendChild(nPage);
61 nPaging.appendChild(nInput);
62 nPaging.appendChild(nOf);
63 $(nInput).change(
function (e) {
65 if (this.value ===
"" || this.value.match(/[^0-9]/)) {
68 var iNewStart = oSettings._iDisplayLength * (this.value - 1);
69 if (iNewStart > oSettings.fnRecordsDisplay()) {
70 oSettings._iDisplayStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength;
71 fnCallbackDraw(oSettings);
74 oSettings._iDisplayStart = iNewStart;
75 fnCallbackDraw(oSettings);
77 $(
'span', nPaging).bind(
'mousedown',
function () {
80 $(
'span', nPaging).bind(
'selectstart',
function () {
92 "fnUpdate":
function (oSettings, fnCallbackDraw) {
93 if (!oSettings.aanFeatures.p) {
96 var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
97 var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
98 var an = oSettings.aanFeatures.p;
99 for (var i = 0, iLen = an.length; i < iLen; i++) {
100 var spans = an[i].getElementsByTagName(
'span');
101 var inputs = an[i].getElementsByTagName(
'select');
102 var elSel = inputs[0];
103 if(elSel.options.length != iPages) {
104 elSel.options.length = 0;
105 for (var j = 0; j < iPages; j++) {
106 var oOption = document.createElement(
'option');
107 oOption.text = j + 1;
108 oOption.value = j + 1;
110 elSel.add(oOption, null);
115 spans[1].innerHTML =
" of " + iPages;
117 elSel.value = iCurrentPage;