|
|
@ -14,93 +14,124 @@
|
|
|
|
* } );
|
|
|
|
* } );
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.dataTableExt.oApi.fnExtStylePagingInfo = 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 )
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.dataTableExt.oPagination.extStyle = {
|
|
|
|
$.fn.dataTableExt.oPagination.extStyle = {
|
|
|
|
"fnInit": function (oSettings, nPaging, fnCallbackDraw) {
|
|
|
|
|
|
|
|
nFirst = $('<span />', { 'class': 'paginate_button first' });
|
|
|
|
|
|
|
|
nPrevious = $('<span />', { 'class': 'paginate_button previous' });
|
|
|
|
"fnInit": function (oSettings, nPaging, fnCallbackDraw) {
|
|
|
|
nNext = $('<span />', { 'class': 'paginate_button next' });
|
|
|
|
|
|
|
|
nLast = $('<span />', { 'class': 'paginate_button last' });
|
|
|
|
var oPaging = oSettings.oInstance.fnExtStylePagingInfo();
|
|
|
|
nPageTxt = $("<span />", { text: 'Page' });
|
|
|
|
|
|
|
|
nPageNumBox = $('<input />', { type: 'text', val: 1, 'class': 'pageinate_input_box' });
|
|
|
|
nFirst = $('<span/>', { 'class': 'paginate_button first' , text : "<<" });
|
|
|
|
nPageOf = $('<span />', { text: 'of' });
|
|
|
|
nPrevious = $('<span/>', { 'class': 'paginate_button previous' , text : "<" });
|
|
|
|
nTotalPages = $('<span />', { text: parseInt(oSettings.aoData.length / oSettings._iDisplayLength, 10) });
|
|
|
|
nNext = $('<span/>', { 'class': 'paginate_button next' , text : ">" });
|
|
|
|
|
|
|
|
nLast = $('<span/>', { 'class': 'paginate_button last' , text : ">>" });
|
|
|
|
$(nPaging)
|
|
|
|
nPageTxt = $("<span />", { text: 'Page' });
|
|
|
|
.append(nFirst)
|
|
|
|
nPageNumBox = $('<input />', { type: 'text', val: 1, 'class': 'pageinate_input_box' });
|
|
|
|
.append(nPrevious)
|
|
|
|
nPageOf = $('<span />', { text: '/' });
|
|
|
|
.append(nPageTxt)
|
|
|
|
nTotalPages = $('<span />', { class : "paginate_total" , text : oPaging.iTotalPages });
|
|
|
|
.append(nPageNumBox)
|
|
|
|
|
|
|
|
.append(nPageOf)
|
|
|
|
|
|
|
|
.append(nTotalPages)
|
|
|
|
$(nPaging)
|
|
|
|
.append(nNext)
|
|
|
|
.append(nFirst)
|
|
|
|
.append(nLast);
|
|
|
|
.append(nPrevious)
|
|
|
|
|
|
|
|
.append(nPageTxt)
|
|
|
|
nFirst.click(function () {
|
|
|
|
.append(nPageNumBox)
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "first");
|
|
|
|
.append(nPageOf)
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
.append(nTotalPages)
|
|
|
|
nPageNumBox.val(parseInt(oSettings._iDisplayEnd / oSettings._iDisplayLength, 10));
|
|
|
|
.append(nNext)
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
.append(nLast);
|
|
|
|
|
|
|
|
|
|
|
|
nPrevious.click(function () {
|
|
|
|
nFirst.click(function () {
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "previous");
|
|
|
|
if( $(this).hasClass("disabled") )
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
return;
|
|
|
|
nPageNumBox.val(parseInt(oSettings._iDisplayEnd / oSettings._iDisplayLength, 10));
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "first");
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
nNext.click(function () {
|
|
|
|
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "next");
|
|
|
|
nPrevious.click(function () {
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
if( $(this).hasClass("disabled") )
|
|
|
|
nPageNumBox.val(parseInt(oSettings._iDisplayEnd / oSettings._iDisplayLength, 10));
|
|
|
|
return;
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "previous");
|
|
|
|
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
nLast.click(function () {
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "last");
|
|
|
|
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
nNext.click(function () {
|
|
|
|
nPageNumBox.val(parseInt(oSettings._iDisplayEnd / oSettings._iDisplayLength,10 ));
|
|
|
|
if( $(this).hasClass("disabled") )
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
return;
|
|
|
|
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "next");
|
|
|
|
nPageNumBox.focus(function () {
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
$(this).attr("style", "border-color: #D0B39A");
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
}).blur(function () {
|
|
|
|
|
|
|
|
$(this).attr("style", "border-color: #C9C9C9");
|
|
|
|
nLast.click(function () {
|
|
|
|
}).change(function () {
|
|
|
|
if( $(this).hasClass("disabled") )
|
|
|
|
var pageValue = parseInt($(this).val(), 10);
|
|
|
|
return;
|
|
|
|
if ((pageValue !== NaN) && pageValue > 0 && pageValue < oSettings.aoData.length) {
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, "last");
|
|
|
|
oSettings._iDisplayStart = $(this).val();
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
}).bind('selectstart', function () { return false; });
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
nPageNumBox.change(function () {
|
|
|
|
|
|
|
|
var pageValue = parseInt($(this).val(), 10) - 1 ; // -1 because pages are 0 indexed, but the UI is 1
|
|
|
|
},
|
|
|
|
var oPaging = oSettings.oInstance.fnPagingInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(pageValue === NaN || pageValue<0 ){
|
|
|
|
"fnUpdate": function (oSettings, fnCallbackDraw) {
|
|
|
|
pageValue = 0;
|
|
|
|
if (!oSettings.aanFeatures.p) {
|
|
|
|
}else if(pageValue >= oPaging.iTotalPages ){
|
|
|
|
return;
|
|
|
|
pageValue = oPaging.iTotalPages -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
oSettings.oApi._fnPageChange(oSettings, pageValue);
|
|
|
|
/* Loop over each instance of the pager */
|
|
|
|
fnCallbackDraw(oSettings);
|
|
|
|
var an = oSettings.aanFeatures.p;
|
|
|
|
});
|
|
|
|
for (var i = 0, iLen = an.length; i < iLen; i++) {
|
|
|
|
|
|
|
|
//var buttons = an[i].getElementsByTagName('span');
|
|
|
|
},
|
|
|
|
var buttons = $(an[i]).find('span.paginate_button');
|
|
|
|
|
|
|
|
if (oSettings._iDisplayStart === 0) {
|
|
|
|
|
|
|
|
buttons.eq(0).attr("class", "paginate_disabled_first paginate_button");
|
|
|
|
"fnUpdate": function (oSettings, fnCallbackDraw) {
|
|
|
|
buttons.eq(1).attr("class", "paginate_disabled_previous paginate_button");
|
|
|
|
if (!oSettings.aanFeatures.p) {
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
else {
|
|
|
|
}
|
|
|
|
buttons.eq(0).attr("class", "paginate_enabled_first paginate_button");
|
|
|
|
|
|
|
|
buttons.eq(1).attr("class", "paginate_enabled_previous paginate_button");
|
|
|
|
var oPaging = oSettings.oInstance.fnExtStylePagingInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Loop over each instance of the pager */
|
|
|
|
if (oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay()) {
|
|
|
|
var an = oSettings.aanFeatures.p;
|
|
|
|
buttons.eq(2).attr("class", "paginate_disabled_next paginate_button");
|
|
|
|
|
|
|
|
buttons.eq(3).attr("class", "paginate_disabled_last paginate_button");
|
|
|
|
$(an).find('span.paginate_total').html(oPaging.iTotalPages);
|
|
|
|
}
|
|
|
|
$(an).find('.pageinate_input_box').val(oPaging.iPage+1);
|
|
|
|
else {
|
|
|
|
|
|
|
|
buttons.eq(2).attr("class", "paginate_enabled_next paginate_button");
|
|
|
|
$(an).each(function(index,item) {
|
|
|
|
buttons.eq(3).attr("class", "paginate_enabled_last paginate_button");
|
|
|
|
|
|
|
|
}
|
|
|
|
var $item = $(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (oPaging.iPage == 0) {
|
|
|
|
|
|
|
|
var prev = $item.find('span.paginate_button.first').add($item.find('span.paginate_button.previous'));
|
|
|
|
|
|
|
|
prev.addClass("disabled");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
var prev = $item.find('span.paginate_button.first').add($item.find('span.paginate_button.previous'));
|
|
|
|
|
|
|
|
prev.removeClass("disabled");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oPaging.iPage+1 == oPaging.iTotalPages) {
|
|
|
|
|
|
|
|
var next = $item.find('span.paginate_button.last').add($item.find('span.paginate_button.next'));
|
|
|
|
|
|
|
|
next.addClass("disabled");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
var next = $item.find('span.paginate_button.last').add($item.find('span.paginate_button.next'));
|
|
|
|
|
|
|
|
next.removeClass("disabled");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|