Added custom columns types detectors and sorters
authorThierry Florac <thierry.florac@onf.fr>
Wed, 07 Oct 2015 18:04:03 +0200
changeset 97 8337e31c9edb
parent 96 7b6902a80d29
child 98 89a28618a327
Added custom columns types detectors and sorters
src/pyams_skin/resources/js/myams-dataTables.js
src/pyams_skin/resources/js/myams-dataTables.min.js
--- a/src/pyams_skin/resources/js/myams-dataTables.js	Wed Oct 07 18:03:25 2015 +0200
+++ b/src/pyams_skin/resources/js/myams-dataTables.js	Wed Oct 07 18:04:03 2015 +0200
@@ -45,6 +45,89 @@
 
 
 	/**
+	 * Custom sorting plug-in
+	 */
+	$.fn.dataTableExt.aTypes.unshift(
+		function(sData) {
+			if (sData !== null && sData.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3}$/)) {
+				return 'date-euro';
+			}
+			return null;
+		}
+	);
+
+	$.fn.dataTableExt.aTypes.unshift(
+		function(sData) {
+			if (sData !== null && sData.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3} - ([0-1][0-9]|2[0-3]):[0-5][0-9]$/)) {
+				return 'datetime-euro';
+			}
+			return null;
+		}
+	);
+
+	$.extend($.fn.dataTableExt.oSort, {
+
+		// numeric-comma column sorter
+		"numeric-comma-asc": function(a, b) {
+			var x = a.replace(/,/, ".").replace(/ /g, '');
+			var y = b.replace(/,/, ".").replace(/ /g, '');
+			x = parseFloat(x);
+			y = parseFloat(y);
+			return ((x < y) ? -1 : ((x > y) ?  1 : 0));
+		},
+		"numeric-comma-desc": function(a, b) {
+			var x = a.replace(/,/, ".").replace(/ /g, '');
+			var y = b.replace(/,/, ".").replace(/ /g, '');
+			x = parseFloat(x);
+			y = parseFloat(y);
+			return ((x < y) ?  1 : ((x > y) ? -1 : 0));
+		},
+
+		// date-euro column sorter
+		"date-euro-pre": function(a) {
+			var trimmed = $.trim(a);
+			if (trimmed != '') {
+				var frDate= trimmed.split('/');
+				var x = (frDate[2] + frDate[1] + frDate[0]) * 1;
+			} else {
+				x = 10000000; // = l'an 1000 ...
+			}
+			return x;
+		},
+
+		"date-euro-asc": function(a, b) {
+			return a - b;
+		},
+
+		"date-euro-desc": function(a, b) {
+			return b - a;
+		},
+
+		// datetime-euro column sorter
+		"datetime-euro-pre": function(a) {
+			var trimmed = $.trim(a);
+			if (trimmed != '') {
+				var frDateTime = trimmed.split(' - ');
+				var frDate= frDateTime[0].split('/');
+				var frTime = frDateTime[1].split(':');
+				var x = (frDate[2] + frDate[1] + frDate[0] + frTime[0] + frTime[1]) * 1;
+			} else {
+				x = 100000000000; // = l'an 1000 ...
+			}
+			return x;
+		},
+
+		"datetime-euro-asc": function(a, b) {
+			return a - b;
+		},
+
+		"datetime-euro-desc": function(a, b) {
+			return b - a;
+		}
+	});
+
+
+	/**
 	 * Bootstrap style pagination control
 	 */
 	$.extend($.fn.dataTableExt.oPagination, {
--- a/src/pyams_skin/resources/js/myams-dataTables.min.js	Wed Oct 07 18:03:25 2015 +0200
+++ b/src/pyams_skin/resources/js/myams-dataTables.min.js	Wed Oct 07 18:04:03 2015 +0200
@@ -1,1 +1,1 @@
-(function(b){b.extend(true,b.fn.dataTable.defaults,{sDom:"R<'dt-top-row'CLF>r<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"_MENU_",sSearch:"_INPUT_"}});b.extend(b.fn.dataTableExt.oStdClasses,{sWrapper:"dataTables_wrapper form-inline"});b.fn.dataTableExt.oApi.fnPagingInfo=function(d){return{iStart:d._iDisplayStart,iEnd:d.fnDisplayEnd(),iLength:d._iDisplayLength,iTotal:d.fnRecordsTotal(),iFilteredTotal:d.fnRecordsDisplay(),iPage:d._iDisplayLength===-1?0:Math.ceil(d._iDisplayStart/d._iDisplayLength),iTotalPages:d._iDisplayLength===-1?0:Math.ceil(d.fnRecordsDisplay()/d._iDisplayLength)}};b.extend(b.fn.dataTableExt.oPagination,{bootstrap:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="prev disabled"><a href="#">'+d.sPrevious+'</a></li><li class="next disabled"><a href="#">'+d.sNext+"</a></li></ul>");var f=b("a",e);b(f[0]).on("click.DT",{action:"previous"},i);b(f[1]).on("click.DT",{action:"next"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){b("li:gt(0)",n[m]).filter(":not(:last)").remove();for(l=d;l<=q;l++){h=(l==k.iPage+1)?'class="active"':"";b("<li "+h+'><a href="#">'+l+"</a></li>").insertBefore(b("li:last",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li:first",n[m]).addClass("disabled")}else{b("li:first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li:last",n[m]).addClass("disabled")}else{b("li:last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_full:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="first disabled"><a href="#">'+d.sFirst+'</a></li><li class="prev disabled"><a href="#">'+d.sPrevious+'</a></li><li class="next disabled"><a href="#">'+d.sNext+'</a></li><li class="last disabled"><a href="#">'+d.sLast+"</a></li></ul>");var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,g,q,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){b("li",n[m]).filter(":not(.first)").filter(":not(.last)").filter(":not(.prev)").filter(":not(.next)").remove();for(l=d;l<=q;l++){h=(l==k.iPage+1)?'class="active"':"";b("<li "+h+'><a href="#">'+l+"</a></li>").insertBefore(b("li.next",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_prevnext:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="first disabled"><a href="#"><i class="fa fa-fw fa-fast-backward"></i></a></li><li class="prev disabled"><a href="#"><i class="fa fa-fw fa-step-backward"></i></a></li><li class="next disabled"><a href="#"><i class="fa fa-fw fa-step-forward"></i></a></li><li class="last disabled"><a href="#"><i class="fa fa-fw fa-fast-forward"></i></a></li></ul>');var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});if(b.fn.DataTable.TableTools){b.extend(true,b.fn.DataTable.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default btn-sm",disabled:"disabled"},collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info modal"},select:{row:"active"}});b.extend(true,b.fn.DataTable.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}})}var a=function(f,e){var d=function(h,g){if(!this.CLASS||this.CLASS!="BootstrapLength"){alert("Warning: BootstrapLength must be initialized with the 'new' keyword")}if(typeof(g)=="undefined"){g={}}if(f.fn.dataTable.camelToHungarian){f.fn.dataTable.camelToHungarian(d.defaults,g)}this.s={dt:null,oInit:g,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};d.aInstances.push(this);this.s.dt=f.fn.dataTable.Api?new f.fn.dataTable.Api(h).settings()[0]:h;this._fnConstruct(g);return this};d.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(n){var o=this;var g=o.s.dt;if(g.oScroll.bInfinite){return}var j=g.sTableId+"_length";var l=f('<select size="1"></select>').attr("name",j);var k,h;var m=g.aLengthMenu;if(m.length==2&&typeof(m[0])=="object"&&typeof(m[1])=="object"){for(k=0,h=m[0].length;k<h;k++){f("<option />").attr("value",m[0][k]).text(m[1][k]).appendTo(l)}}else{for(k=0,h=m.length;k<h;k++){f("<option />").attr("value",m[k]).text(m[k]).appendTo(l)}}var p=f("<div>").addClass(g.oClasses.sLength).append(f("<span></span>").addClass("ams-form").append(f("<label></label>").addClass("select").css("width",60).append(l).append(f("<i></i>"))));if(!g.aanFeatures.L){p.attr("id",g.sTableId+"_length")}this.dom.wrapper=p.get(0);f('select option[value="'+g._iDisplayLength+'"]',p).attr("selected",true);f("select",p).on("change.DT",function(i){var q=f(this).val();var r=g.aanFeatures.L;for(k=0,h=r.length;k<h;k++){if(r[k]!=this.parentNode){f("select",r[k]).val(q)}}g._iDisplayLength=parseInt(q,10);g.oInstance._fnCalculateEnd(g);if(g.fnDisplayEnd()==g.fnRecordsDisplay()){g._iDisplayStart=g.fnDisplayEnd()-g._iDisplayLength;if(g._iDisplayStart<0){g._iDisplayStart=0}}if(g._iDisplayLength==-1){g._iDisplayStart=0}g.oInstance._fnDraw()});f("select",p).attr("aria-controls",g.sTableId)}};d.fnRebuild=function(g){};d.defaults={};d.aInstances=[];d.prototype.CLASS="BootstrapLength";d.VERSION="1.0.0";d.prototype.VERSION=d.VERSION;if((typeof(f.fn.dataTable)=="function")&&(typeof(f.fn.dataTableExt.fnVersionCheck)=="function")&&f.fn.dataTableExt.fnVersionCheck("1.7.0")){f.fn.dataTableExt.aoFeatures.push({fnInit:function(h){var i=h.oInit;var g=new d(h,i.bootstrapLength||i.oBootstrapLength||{});return g.input()},cFeature:"L",sFeature:"BootstrapLength"})}else{alert("Warning: BootstrapLength required DataTables 1.7 or greater...")}f.fn.dataTable.BootstrapLength=d;return d};if(!jQuery.fn.dataTable.BootstrapLength){a(b,b.fn.dataTable)}var c=function(f,e){var d=function(h,g){if(!this.CLASS||this.CLASS!="BootstrapFilter"){alert("Warning: BootstrapFilter must be initialized with the 'new' keyword")}if(typeof(g)=="undefined"){g={}}if(f.fn.dataTable.camelToHungarian){f.fn.dataTable.camelToHungarian(d.defaults,g)}this.s={dt:null,oInit:g,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};d.aInstances.push(this);this.s.dt=f.fn.dataTable.Api?new f.fn.dataTable.Api(h).settings()[0]:h;this._fnConstruct(g);return this};d.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(m){var h=this;var j=h.s.dt;var g=j.oPreviousSearch;var l='<input type="text">';var i=f("<div>").addClass(j.oClasses.sFilter).html('<div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span>'+l+"</div>");if(!j.aanFeatures.F){i.attr("id",j.sTableId+"_filter")}this.dom.wrapper=i.get(0);var k=f('input[type="text"]',i);i.data("DT_Input",k[0]);k.val(g.sSearch.replace('"',"&quot;")).addClass("form-control").attr("placeholder",j.oLanguage.sSearch).attr("aria-control",j.sTableId).on("keyup.DT",function(q){var s=j.aanFeatures.F;var r=f(this).val();for(var p=0,o=s.length;p<o;p++){if(s[p]!=f(this).parents("div.dataTables_filter")[0]){f(s[p]).data("DT_Input").val(r)}}if(r!=g.sSearch){j.oInstance._fnFilterComplete({sSearch:r,bRegex:g.bRegex,bSmart:g.bSmart,bCaseInsensitive:g.bCaseInsensitive})}}).on("keypress.DT",function(n){if(n.keyCode==13){return false}})}};d.fnRebuild=function(g){};d.defaults={};d.aInstances=[];d.prototype.CLASS="BootstrapFilter";d.VERSION="1.0.0";d.prototype.VERSION=d.VERSION;if((typeof(f.fn.dataTable)=="function")&&(typeof(f.fn.dataTableExt.fnVersionCheck)=="function")&&f.fn.dataTableExt.fnVersionCheck("1.7.0")){f.fn.dataTableExt.aoFeatures.push({fnInit:function(h){var i=h.oInit;var g=new d(h,i.bootstrapFilter||i.oBootstrapFilter||{});return g.input()},cFeature:"F",sFeature:"BootstrapFilter"})}else{alert("Warning: BootstrapFilter required DataTables 1.7 or greater...")}f.fn.dataTable.BootstrapFilter=d;return d};if(!jQuery.fn.dataTable.BootstrapFilter){c(b,b.fn.dataTable)}})(jQuery);
\ No newline at end of file
+(function(b){b.extend(true,b.fn.dataTable.defaults,{sDom:"R<'dt-top-row'CLF>r<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"_MENU_",sSearch:"_INPUT_"}});b.extend(b.fn.dataTableExt.oStdClasses,{sWrapper:"dataTables_wrapper form-inline"});b.fn.dataTableExt.oApi.fnPagingInfo=function(d){return{iStart:d._iDisplayStart,iEnd:d.fnDisplayEnd(),iLength:d._iDisplayLength,iTotal:d.fnRecordsTotal(),iFilteredTotal:d.fnRecordsDisplay(),iPage:d._iDisplayLength===-1?0:Math.ceil(d._iDisplayStart/d._iDisplayLength),iTotalPages:d._iDisplayLength===-1?0:Math.ceil(d.fnRecordsDisplay()/d._iDisplayLength)}};b.fn.dataTableExt.aTypes.unshift(function(d){if(d!==null&&d.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3}$/)){return"date-euro"}return null});b.fn.dataTableExt.aTypes.unshift(function(d){if(d!==null&&d.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3} - ([0-1][0-9]|2[0-3]):[0-5][0-9]$/)){return"datetime-euro"}return null});b.extend(b.fn.dataTableExt.oSort,{"numeric-comma-asc":function(f,e){var d=f.replace(/,/,".").replace(/ /g,"");var g=e.replace(/,/,".").replace(/ /g,"");d=parseFloat(d);g=parseFloat(g);return((d<g)?-1:((d>g)?1:0))},"numeric-comma-desc":function(f,e){var d=f.replace(/,/,".").replace(/ /g,"");var g=e.replace(/,/,".").replace(/ /g,"");d=parseFloat(d);g=parseFloat(g);return((d<g)?1:((d>g)?-1:0))},"date-euro-pre":function(f){var g=b.trim(f);if(g!=""){var e=g.split("/");var d=(e[2]+e[1]+e[0])*1}else{d=10000000}return d},"date-euro-asc":function(e,d){return e-d},"date-euro-desc":function(e,d){return d-e},"datetime-euro-pre":function(f){var i=b.trim(f);if(i!=""){var g=i.split(" - ");var e=g[0].split("/");var h=g[1].split(":");var d=(e[2]+e[1]+e[0]+h[0]+h[1])*1}else{d=100000000000}return d},"datetime-euro-asc":function(e,d){return e-d},"datetime-euro-desc":function(e,d){return d-e}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="prev disabled"><a href="#">'+d.sPrevious+'</a></li><li class="next disabled"><a href="#">'+d.sNext+"</a></li></ul>");var f=b("a",e);b(f[0]).on("click.DT",{action:"previous"},i);b(f[1]).on("click.DT",{action:"next"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){b("li:gt(0)",n[m]).filter(":not(:last)").remove();for(l=d;l<=q;l++){h=(l==k.iPage+1)?'class="active"':"";b("<li "+h+'><a href="#">'+l+"</a></li>").insertBefore(b("li:last",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li:first",n[m]).addClass("disabled")}else{b("li:first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li:last",n[m]).addClass("disabled")}else{b("li:last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_full:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="first disabled"><a href="#">'+d.sFirst+'</a></li><li class="prev disabled"><a href="#">'+d.sPrevious+'</a></li><li class="next disabled"><a href="#">'+d.sNext+'</a></li><li class="last disabled"><a href="#">'+d.sLast+"</a></li></ul>");var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,g,q,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){b("li",n[m]).filter(":not(.first)").filter(":not(.last)").filter(":not(.prev)").filter(":not(.next)").remove();for(l=d;l<=q;l++){h=(l==k.iPage+1)?'class="active"':"";b("<li "+h+'><a href="#">'+l+"</a></li>").insertBefore(b("li.next",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_prevnext:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="first disabled"><a href="#"><i class="fa fa-fw fa-fast-backward"></i></a></li><li class="prev disabled"><a href="#"><i class="fa fa-fw fa-step-backward"></i></a></li><li class="next disabled"><a href="#"><i class="fa fa-fw fa-step-forward"></i></a></li><li class="last disabled"><a href="#"><i class="fa fa-fw fa-fast-forward"></i></a></li></ul>');var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});if(b.fn.DataTable.TableTools){b.extend(true,b.fn.DataTable.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default btn-sm",disabled:"disabled"},collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info modal"},select:{row:"active"}});b.extend(true,b.fn.DataTable.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}})}var a=function(f,e){var d=function(h,g){if(!this.CLASS||this.CLASS!="BootstrapLength"){alert("Warning: BootstrapLength must be initialized with the 'new' keyword")}if(typeof(g)=="undefined"){g={}}if(f.fn.dataTable.camelToHungarian){f.fn.dataTable.camelToHungarian(d.defaults,g)}this.s={dt:null,oInit:g,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};d.aInstances.push(this);this.s.dt=f.fn.dataTable.Api?new f.fn.dataTable.Api(h).settings()[0]:h;this._fnConstruct(g);return this};d.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(n){var o=this;var g=o.s.dt;if(g.oScroll.bInfinite){return}var j=g.sTableId+"_length";var l=f('<select size="1"></select>').attr("name",j);var k,h;var m=g.aLengthMenu;if(m.length==2&&typeof(m[0])=="object"&&typeof(m[1])=="object"){for(k=0,h=m[0].length;k<h;k++){f("<option />").attr("value",m[0][k]).text(m[1][k]).appendTo(l)}}else{for(k=0,h=m.length;k<h;k++){f("<option />").attr("value",m[k]).text(m[k]).appendTo(l)}}var p=f("<div>").addClass(g.oClasses.sLength).append(f("<span></span>").addClass("ams-form").append(f("<label></label>").addClass("select").css("width",60).append(l).append(f("<i></i>"))));if(!g.aanFeatures.L){p.attr("id",g.sTableId+"_length")}this.dom.wrapper=p.get(0);f('select option[value="'+g._iDisplayLength+'"]',p).attr("selected",true);f("select",p).on("change.DT",function(i){var q=f(this).val();var r=g.aanFeatures.L;for(k=0,h=r.length;k<h;k++){if(r[k]!=this.parentNode){f("select",r[k]).val(q)}}g._iDisplayLength=parseInt(q,10);g.oInstance._fnCalculateEnd(g);if(g.fnDisplayEnd()==g.fnRecordsDisplay()){g._iDisplayStart=g.fnDisplayEnd()-g._iDisplayLength;if(g._iDisplayStart<0){g._iDisplayStart=0}}if(g._iDisplayLength==-1){g._iDisplayStart=0}g.oInstance._fnDraw()});f("select",p).attr("aria-controls",g.sTableId)}};d.fnRebuild=function(g){};d.defaults={};d.aInstances=[];d.prototype.CLASS="BootstrapLength";d.VERSION="1.0.0";d.prototype.VERSION=d.VERSION;if((typeof(f.fn.dataTable)=="function")&&(typeof(f.fn.dataTableExt.fnVersionCheck)=="function")&&f.fn.dataTableExt.fnVersionCheck("1.7.0")){f.fn.dataTableExt.aoFeatures.push({fnInit:function(h){var i=h.oInit;var g=new d(h,i.bootstrapLength||i.oBootstrapLength||{});return g.input()},cFeature:"L",sFeature:"BootstrapLength"})}else{alert("Warning: BootstrapLength required DataTables 1.7 or greater...")}f.fn.dataTable.BootstrapLength=d;return d};if(!jQuery.fn.dataTable.BootstrapLength){a(b,b.fn.dataTable)}var c=function(f,e){var d=function(h,g){if(!this.CLASS||this.CLASS!="BootstrapFilter"){alert("Warning: BootstrapFilter must be initialized with the 'new' keyword")}if(typeof(g)=="undefined"){g={}}if(f.fn.dataTable.camelToHungarian){f.fn.dataTable.camelToHungarian(d.defaults,g)}this.s={dt:null,oInit:g,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};d.aInstances.push(this);this.s.dt=f.fn.dataTable.Api?new f.fn.dataTable.Api(h).settings()[0]:h;this._fnConstruct(g);return this};d.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(m){var h=this;var j=h.s.dt;var g=j.oPreviousSearch;var l='<input type="text">';var i=f("<div>").addClass(j.oClasses.sFilter).html('<div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span>'+l+"</div>");if(!j.aanFeatures.F){i.attr("id",j.sTableId+"_filter")}this.dom.wrapper=i.get(0);var k=f('input[type="text"]',i);i.data("DT_Input",k[0]);k.val(g.sSearch.replace('"',"&quot;")).addClass("form-control").attr("placeholder",j.oLanguage.sSearch).attr("aria-control",j.sTableId).on("keyup.DT",function(q){var s=j.aanFeatures.F;var r=f(this).val();for(var p=0,o=s.length;p<o;p++){if(s[p]!=f(this).parents("div.dataTables_filter")[0]){f(s[p]).data("DT_Input").val(r)}}if(r!=g.sSearch){j.oInstance._fnFilterComplete({sSearch:r,bRegex:g.bRegex,bSmart:g.bSmart,bCaseInsensitive:g.bCaseInsensitive})}}).on("keypress.DT",function(n){if(n.keyCode==13){return false}})}};d.fnRebuild=function(g){};d.defaults={};d.aInstances=[];d.prototype.CLASS="BootstrapFilter";d.VERSION="1.0.0";d.prototype.VERSION=d.VERSION;if((typeof(f.fn.dataTable)=="function")&&(typeof(f.fn.dataTableExt.fnVersionCheck)=="function")&&f.fn.dataTableExt.fnVersionCheck("1.7.0")){f.fn.dataTableExt.aoFeatures.push({fnInit:function(h){var i=h.oInit;var g=new d(h,i.bootstrapFilter||i.oBootstrapFilter||{});return g.input()},cFeature:"F",sFeature:"BootstrapFilter"})}else{alert("Warning: BootstrapFilter required DataTables 1.7 or greater...")}f.fn.dataTable.BootstrapFilter=d;return d};if(!jQuery.fn.dataTable.BootstrapFilter){c(b,b.fn.dataTable)}})(jQuery);
\ No newline at end of file