/*! DataTables 1.10.2 * ©2008-2014 SpryMedia Ltd - datatables.net/license */ (function(za,O,l){var N=function(h){function T(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),d[c]=e,"o"===b[1]&&T(a[e])});a._hungarianMap=d}function G(a,b,c){a._hungarianMap||T(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==l&&(c||b[d]===l))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),G(a[d],b[d],c)):b[d]=b[e]})}function N(a){var b=p.defaults.oLanguage,c=a.sZeroRecords; !a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&D(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&D(a,a,"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&cb(a)}function db(a){w(a,"ordering","bSort");w(a,"orderMulti","bSortMulti");w(a,"orderClasses","bSortClasses");w(a,"orderCellsTop","bSortCellsTop");w(a,"order","aaSorting");w(a,"orderFixed","aaSortingFixed");w(a,"paging","bPaginate"); w(a,"pagingType","sPaginationType");w(a,"pageLength","iDisplayLength");w(a,"searching","bFilter");if(a=a.aoSearchCols)for(var b=0,c=a.length;b").css({position:"absolute",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(h("
").css({position:"absolute",top:1,left:1,width:100, overflow:"scroll"}).append(h('
').css({width:"100%",height:10}))).appendTo("body"),c=b.find(".test");a.bScrollOversize=100===c[0].offsetWidth;a.bScrollbarLeft=1!==c.offset().left;b.remove()}function gb(a,b,c,d,e,f){var g,j=!1;c!==l&&(g=c,j=!0);for(;d!==e;)a.hasOwnProperty(d)&&(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Aa(a,b){var c=p.defaults.column,d=a.aoColumns.length,c=h.extend({},p.models.oColumn,c,{nTh:b?b:O.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML: "",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},p.models.oSearch,c[d]);fa(a,d,null)}function fa(a,b,c){var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var f=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==l&&null!==c&&(eb(c),G(p.defaults.column,c),c.mDataProp!==l&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&& !c.sClass&&(c.sClass=c.className),h.extend(b,c),D(b,c,"sWidth","sWidthOrig"),"number"===typeof c.iDataSort&&(b.aDataSort=[c.iDataSort]),D(b,c,"aDataSort"));var g=b.mData,j=U(g),i=b.mRender?U(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b.fnGetData=function(a,b,c){var d=j(a,b,l,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return Ba(g)(a,b,c)};a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone)); a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function V(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Ca(a);for(var c=0,d=b.length;co[f])d(m.length+ o[f],n);else if("string"===typeof o[f]){j=0;for(i=m.length;jb&&a[e]--; -1!=d&&c===l&&a.splice(d,1)}function la(a,b,c,d){var e=a.aoData[b],f;if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData= ia(a,e).data;else{var g=e.anCells,j;if(g){c=0;for(f=g.length;c").appendTo(g));b=0;for(c=m.length;btr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(n.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(n.sFooterTH);if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);var g=a._iDisplayStart,n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,B(a,!1);else if(j){if(!a.bDestroying&&!jb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:n;for(j=j?0:g;j",{"class":e?d[0]:""}).append(h("",{valign:"top",colSpan:Z(a),"class":a.oClasses.sRowEmpty}).html(c))[0];u(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ha(a),g,n,i]);u(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0], Ha(a),g,n,i]);d=h(a.nTBody);d.children().detach();d.append(h(b));u(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function L(a,b){var c=a.oFeatures,d=c.bFilter;c.bSort&&kb(a);d?ca(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;K(a);a._drawHold=!1}function lb(a){var b=a.oClasses,c=h(a.nTable),c=h("
").insertBefore(c),d=a.oFeatures,e=h("
",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)}); a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,n,m,o,k=0;k")[0];n=f[k+1];if("'"==n||'"'==n){m="";for(o=2;f[k+o]!=n;)m+=f[k+o],o++;"H"==m?m=b.sJUIHeader:"F"==m&&(m=b.sJUIFooter);-1!=m.indexOf(".")?(n=m.split("."),i.id=n[0].substr(1,n[0].length-1),i.className=n[1]):"#"==m.charAt(0)?i.id=m.substr(1,m.length-1):i.className=m;k+=o}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"== j&&d.bPaginate&&d.bLengthChange)g=mb(a);else if("f"==j&&d.bFilter)g=nb(a);else if("r"==j&&d.bProcessing)g=ob(a);else if("t"==j)g=pb(a);else if("i"==j&&d.bInfo)g=qb(a);else if("p"==j&&d.bPaginate)g=rb(a);else if(0!==p.ext.feature.length){i=p.ext.feature;o=0;for(n=i.length;o',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("
", {id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("
").addClass(b.sLength); a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).bind("change.DT",function(){Pa(a,h(this).val());K(a)});h(a.nTable).bind("length.dt.DT",function(b,c,d){a===c&&h("select",i).val(d)});return i[0]}function rb(a){var b=a.sPaginationType,c=p.ext.pager[b],d="function"===typeof c,e=function(a){K(a)},b=h("
").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+ "_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),m=-1===i,b=m?0:Math.ceil(b/i),i=m?1:Math.ceil(h/i),h=c(b,i),o,m=0;for(o=f.p.length;mf&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"== b?d+e",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function B(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");u(a,null,"processing",[a,b])}function pb(a){var b=h(a.nTable);b.attr("role", "grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),n=h(b[0].cloneNode(!1)),m=b.children("tfoot");c.sX&&"100%"===b.attr("width")&&b.removeAttr("width");m.length||(m=null);c=h("
",{"class":f.sScrollWrapper}).append(h("
",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?!d?null:s(d):"100%"}).append(h("
",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box", width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append(b.children("thead")))).append("top"===j?g:null)).append(h("
",{"class":f.sScrollBody}).css({overflow:"auto",height:!e?null:s(e),width:!d?null:s(d)}).append(b));m&&c.append(h("
",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:s(d):"100%"}).append(h("
",{"class":f.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",0).append(b.children("tfoot")))).append("bottom"===j?g: null));var b=c.children(),o=b[0],f=b[1],k=m?b[2]:null;d&&h(f).scroll(function(){var a=this.scrollLeft;o.scrollLeft=a;m&&(k.scrollLeft=a)});a.nScrollHead=o;a.nScrollBody=f;a.nScrollFoot=k;a.aoDrawCallback.push({fn:W,sName:"scrolling"});return c[0]}function W(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,f=b.iBarWidth,g=h(a.nScrollHead),j=g[0].style,i=g.children("div"),n=i[0].style,m=i.children("table"),i=a.nScrollBody,o=h(i),k=i.style,l=h(a.nScrollFoot).children("div"),p=l.children("table"),r=h(a.nTHead), q=h(a.nTable),da=q[0],M=da.style,J=a.nTFoot?h(a.nTFoot):null,u=a.oBrowser,v=u.bScrollOversize,y,t,x,w,z,A=[],B=[],C=[],D,E=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};q.children("thead, tfoot").remove();z=r.clone().prependTo(q);y=r.find("tr");x=z.find("tr");z.find("th, td").removeAttr("tabindex");J&&(w=J.clone().prependTo(q),t=J.find("tr"),w=w.find("tr"));c||(k.width="100%",g[0].style.width="100%");h.each(ma(a,z),function(b,c){D= ga(a,b);c.style.width=a.aoColumns[D].sWidth});J&&F(function(a){a.style.width=""},w);b.bCollapse&&""!==e&&(k.height=o[0].offsetHeight+r[0].offsetHeight+"px");g=q.outerWidth();if(""===c){if(M.width="100%",v&&(q.find("tbody").height()>i.offsetHeight||"scroll"==o.css("overflow-y")))M.width=s(q.outerWidth()-f)}else""!==d?M.width=s(d):g==o.width()&&o.height()g-f&&(M.width=s(g))):M.width=s(g);g=q.outerWidth();F(E,x);F(function(a){C.push(a.innerHTML);A.push(s(h(a).css("width")))}, x);F(function(a,b){a.style.width=A[b]},y);h(x).height(0);J&&(F(E,w),F(function(a){B.push(s(h(a).css("width")))},w),F(function(a,b){a.style.width=B[b]},t),h(w).height(0));F(function(a,b){a.innerHTML='
'+C[b]+"
";a.style.width=A[b]},x);J&&F(function(a,b){a.innerHTML="";a.style.width=B[b]},w);if(q.outerWidth()i.offsetHeight||"scroll"==o.css("overflow-y")?g+f:g;if(v&&(i.scrollHeight>i.offsetHeight||"scroll"==o.css("overflow-y")))M.width= s(t-f);(""===c||""!==d)&&P(a,1,"Possible column misalignment",6)}else t="100%";k.width=s(t);j.width=s(t);J&&(a.nScrollFoot.style.width=s(t));!e&&v&&(k.height=s(da.offsetHeight+f));e&&b.bCollapse&&(k.height=s(e),b=c&&da.offsetWidth>i.offsetWidth?f:0,da.offsetHeighti.clientHeight||"scroll"==o.css("overflow-y");u="padding"+(u.bScrollbarLeft?"Left":"Right");n[u]=m?f+"px":"0px";J&&(p[0].style.width= s(b),l[0].style.width=s(b),l[0].style[u]=m?f+"px":"0px");o.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)i.scrollTop=0}function F(a,b,c){for(var d=0,e=0,f=b.length,g,j;e"));j.find("tfoot th, tfoot td").css("width","");var p=j.find("tbody tr"),i=ma(a,j.find("thead")[0]);for(k=0;k").css("width",s(a)).appendTo(b||O.body),d=c[0].offsetWidth;c.remove();return d}function Eb(a,b){var c= a.oScroll;if(c.sX||c.sY)c=!c.sX?c.iBarWidth:0,b.style.width=s(h(b).outerWidth()-c)}function Db(a,b){var c=Fb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("").html(A(a,c,b,"display"))[0]:d.anCells[b]}function Fb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;fd&&(d=c.length,e=f);return e}function s(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function Gb(){if(!p.__scrollbarWidth){var a= h("

").css({width:"100%",height:200,padding:0})[0],b=h("

").css({position:"absolute",top:0,left:0,width:200,height:150,padding:0,overflow:"hidden",visibility:"hidden"}).append(a).appendTo("body"),c=a.offsetWidth;b.css("overflow","scroll");a=a.offsetWidth;c===a&&(a=b[0].clientWidth);b.remove();p.__scrollbarWidth=c-a}return p.__scrollbarWidth}function R(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var n=[];f=function(a){a.length&&!h.isArray(a[0])?n.push(a):n.push.apply(n, a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;ae?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return ce?1:0}):i.sort(function(a,b){var c,g,j,i,l=h.length,p=f[a]._aSortData,r=f[b]._aSortData;for(j=0;jg?1:0})}a.bSorted=!0}function Ib(a){for(var b,c, d=a.aoColumns,e=R(a),a=a.oLanguage.oAria,f=0,g=d.length;f/g,"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0=f.length?0:b+1};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,C(e,"0")),-1!==c?(b=g(e[c]),e[c][1]=f[b],e[c]._idx=b):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);L(a);"function"==typeof d&&d(a)}function Ka(a,b,c,d){var e=a.aoColumns[c];Ta(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(B(a,!0),setTimeout(function(){Sa(a,c,b.shiftKey, d);"ssp"!==z(a)&&B(a,!1)},0)):Sa(a,c,b.shiftKey,d))})}function sa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=R(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;ee?e+1:3));e=0;for(f=d.length;ee?e+1:3))}a.aLastSort=d}function Hb(a,b){var c=a.aoColumns[b],d=p.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,Y(a,b)));for(var f,g=p.ext.type.order[c.sType+ "-pre"],j=0,i=a.aoData.length;j= d.length?[0,c[1]]:c)});h.extend(a.oPreviousSearch,zb(e.search));b=0;for(c=e.columns.length;bb)b=0;a._iDisplayStart=b}function La(a,b){var c= a.renderer,d=p.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function z(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function Ua(a,b){var c=[],c=Lb.numbers_length,d=Math.floor(c/2);b<=c?c=S(0,b):a<=d?(c=S(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=S(b-(c-2),b):(c=S(a-1,a+2),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return va(b, a)},"num-fmt":function(b){return va(b,a,Va)},"html-num":function(b){return va(b,a,wa)},"html-num-fmt":function(b){return va(b,a,wa,Va)}},function(b,c){t.type.order[b+a+"-pre"]=c})}function Mb(a){return function(){var b=[ua(this[p.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return p.ext.internal[a].apply(this,b)}}var p,t,q,r,v,Wa={},Nb=/[\r\n]/g,wa=/<.*?>/g,Yb=/^[\w\+\-]/,Zb=/[\w\+\-]$/,Vb=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Va=/[',$\u00a3\u20ac\u00a5%\u2009\u202F]/g, H=function(a){return!a||!0===a||"-"===a?!0:!1},Ob=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Pb=function(a,b){Wa[b]||(Wa[b]=RegExp(Oa(b),"g"));return"string"===typeof a?a.replace(/\./g,"").replace(Wa[b],"."):a},Xa=function(a,b,c){var d="string"===typeof a;b&&d&&(a=Pb(a,b));c&&d&&(a=a.replace(Va,""));return H(a)||!isNaN(parseFloat(a))&&isFinite(a)},Qb=function(a,b,c){return H(a)?!0:!(H(a)||"string"===typeof a)?null:Xa(a.replace(wa,""),b,c)?!0:null},C=function(a,b,c){var d= [],e=0,f=a.length;if(c!==l)for(;e")[0],Wb=qa.textContent!==l,Xb=/<.*?>/g;p=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new q(ua(this[t.iApiIndex])):new q(this)};this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===l||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing= function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===l||a?b.draw(!1):(""!==d.sX||""!==d.sY)&&W(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===l||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===l||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(!a)}; this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===l?e.search(a,c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==l){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==l||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==l?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase(); return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===l||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===l||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return ua(this[t.iApiIndex])}; this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===l||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===l||e)&&h.columns.adjust();(d===l||d)&&h.draw();return 0};this.fnVersionCheck=t.fnVersionCheck;var b=this,c=a===l,d=this.length;c&&(a={});this.oApi=this.internal=t.internal;for(var e in p.ext.internal)e&&(this[e]=Mb(e));this.each(function(){var e={},g=1t<"F"ip>'),k.renderer)?h.isPlainObject(k.renderer)&&!k.renderer.header&&(k.renderer.header="jqueryui"):k.renderer="jqueryui":h.extend(n,p.ext.classes,g.oClasses);h(this).addClass(n.sTable);if(""!==k.oScroll.sX||""!==k.oScroll.sY)k.oScroll.iBarWidth=Gb();!0===k.oScroll.sX&&(k.oScroll.sX= "100%");k.iInitDisplayStart===l&&(k.iInitDisplayStart=g.iDisplayStart,k._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(k.bDeferLoading=!0,j=h.isArray(g.iDeferLoading),k._iRecordsDisplay=j?g.iDeferLoading[0]:g.iDeferLoading,k._iRecordsTotal=j?g.iDeferLoading[1]:g.iDeferLoading);""!==g.oLanguage.sUrl?(k.oLanguage.sUrl=g.oLanguage.sUrl,h.getJSON(k.oLanguage.sUrl,null,function(a){N(a);G(m.oLanguage,a);h.extend(true,k.oLanguage,g.oLanguage,a);ra(k)}),e=!0):h.extend(!0,k.oLanguage,g.oLanguage); null===g.asStripeClasses&&(k.asStripeClasses=[n.sStripeOdd,n.sStripeEven]);var j=k.asStripeClasses,r=h("tbody tr:eq(0)",this);-1!==h.inArray(!0,h.map(j,function(a){return r.hasClass(a)}))&&(h("tbody tr",this).removeClass(j.join(" ")),k.asDestroyStripes=j.slice());var o=[],q,j=this.getElementsByTagName("thead");0!==j.length&&(aa(k.aoHeader,j[0]),o=ma(k));if(null===g.aoColumns){q=[];j=0;for(i=o.length;j").appendTo(this));k.nTHead= i[0];i=h(this).children("tbody");0===i.length&&(i=h("").appendTo(this));k.nTBody=i[0];i=h(this).children("tfoot");if(0===i.length&&0").appendTo(this);0===i.length||0===i.children().length?h(this).addClass(n.sNoFooter):0a?new q(b[a],this[a]):null},filter:function(a){var b=[];if(y.filter)b=y.filter.call(this,a,this);else for(var c=0,d=this.length;c").addClass(b);h("td",c).addClass(b).html(a)[0].colSpan=Z(d);e.push(c[0])}};if(h.isArray(a)|| a instanceof h)for(var g=0,j=a.length;g=0?c:f.length+c];var e=typeof a==="string"?a.match(ac):"";if(e)switch(e[2]){case "visIdx":case "visible":a=parseInt(e[1],10);if(a<0){c=h.map(f,function(a, b){return a.bVisible?b:null});return[c[c.length+a]]}return[ga(b,a)];case "name":return h.map(g,function(a,b){return a===e[1]?b:null})}else return h(j).filter(a).map(function(){return h.inArray(this,j)}).toArray()})});c.selector.cols=a;c.selector.opts=b;return c});v("columns().header()","column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh})});v("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf})}); v("columns().data()","column().data()",function(){return this.iterator("column-rows",function(a,b,c,d,e){for(var c=[],d=0,f=e.length;dd;return!0};p.isDataTable=p.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;h.each(p.settings,function(a,e){if(e.nTable===b||e.nScrollHead=== b||e.nScrollFoot===b)c=!0});return c};p.tables=p.fnTables=function(a){return jQuery.map(p.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable})};p.camelToHungarian=G;r("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){r(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0].match(/\.dt\b/)||(a[0]+=".dt");var d=h(this.tables().nodes());d[b].apply(d,a);return this})}); r("clear()",function(){return this.iterator("table",function(a){ja(a)})});r("settings()",function(){return new q(this.context,this.context)});r("data()",function(){return this.iterator("table",function(a){return C(a.aoData,"_aData")}).flatten()});r("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),l=h(b.nTableWrapper),m=h.map(b.aoData,function(a){return a.nTr}),o;b.bDestroying= !0;u(b,"aoDestroyCallback","destroy",[b]);a||(new q(b)).columns().visible(!0);l.unbind(".DT").find(":not(tbody *)").unbind(".DT");h(za).unbind(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));i.detach();l.detach();b.aaSorting=[];b.aaSortingFixed=[];sa(b);h(m).removeClass(b.asStripeClasses.join(" "));h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);b.bJUI&& (h("th span."+d.sSortIcon+", td span."+d.sSortIcon,g).detach(),h("th, td",g).each(function(){var a=h("div."+d.sSortJUIWrapper,this);h(this).append(a.contents());a.detach()}));!a&&c&&c.insertBefore(e,b.nTableReinsertBefore);f.children().detach();f.append(m);i.css("width",b.sDestroyWidth).removeClass(d.sTable);(o=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%o])});c=h.inArray(b,p.settings);-1!==c&&p.settings.splice(c,1)})});p.version="1.10.2";p.settings= [];p.models={};p.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};p.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null};p.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std", sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};p.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1, fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null, fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"}, sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},p.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",sPaginationType:"simple_numbers", sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null};T(p.defaults);p.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};T(p.defaults.column);p.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null, bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[], aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:l,oAjaxData:l, fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==z(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==z(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a= this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{}};p.ext=t={classes:{},errMode:"alert",feature:[],search:[],internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:p.fnVersionCheck, iApiIndex:0,oJUIClasses:{},sVersion:p.version};h.extend(t,{afnFiltering:t.search,aTypes:t.type.detect,ofnSearch:t.type.search,oSort:t.type.order,afnSortData:t.order,aoFeatures:t.feature,oApi:t.internal,oStdClasses:t.classes,oPagination:t.pager});h.extend(p.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter", sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody", sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var ya="",ya="",E=ya+"ui-state-default",ea=ya+"css_right ui-icon ui-icon-",Ub=ya+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";h.extend(p.ext.oJUIClasses,p.ext.classes,{sPageButton:"fg-button ui-button "+E,sPageButtonActive:"ui-state-disabled", sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:E+" sorting_asc",sSortDesc:E+" sorting_desc",sSortable:E+" sorting",sSortableAsc:E+" sorting_asc_disabled",sSortableDesc:E+" sorting_desc_disabled",sSortableNone:E+" sorting_disabled",sSortJUIAsc:ea+"triangle-1-n",sSortJUIDesc:ea+"triangle-1-s",sSortJUI:ea+"carat-2-n-s",sSortJUIAscAllowed:ea+"carat-1-n",sSortJUIDescAllowed:ea+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper", sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+E,sScrollFoot:"dataTables_scrollFoot "+E,sHeaderTH:E,sFooterTH:E,sJUIHeader:Ub+" ui-corner-tl ui-corner-tr",sJUIFooter:Ub+" ui-corner-bl ui-corner-br"});var Lb=p.ext.pager;h.extend(Lb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},simple_numbers:function(a,b){return["previous",Ua(a,b),"next"]},full_numbers:function(a,b){return["first","previous",Ua(a,b),"next","last"]},_numbers:Ua, numbers_length:7});h.extend(!0,p.ext.renderer,{pageButton:{_:function(a,b,c,d,e,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i,l,m=0,o=function(b,d){var k,p,r,q,s=function(b){Ra(a,b.data.action,true)};k=0;for(p=d.length;k").appendTo(b);o(r,q)}else{l=i="";switch(q){case "ellipsis":b.append("");break;case "first":i=j.sFirst;l=q+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":i=j.sPrevious;l=q+(e>0?"":" "+g.sPageButtonDisabled); break;case "next":i=j.sNext;l=q+(e",{"class":g.sPageButton+" "+l,"aria-controls":a.sTableId,"data-dt-idx":m,tabindex:a.iTabIndex,id:c===0&&typeof q==="string"?a.sTableId+"_"+q:null}).html(i).appendTo(b);Ta(r,{action:q},s);m++}}}};try{var k=h(O.activeElement).data("dt-idx");o(h(b).empty(),d);k!==null&&h(b).find("[data-dt-idx="+k+"]").focus()}catch(p){}}}}); var va=function(a,b,c,d){if(!a||"-"===a)return-Infinity;b&&(a=Pb(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(t.type.order,{"date-pre":function(a){return Date.parse(a)||0},"html-pre":function(a){return H(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return H(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return ab?1:0},"string-desc":function(a,b){return a b?-1:0}});cb("");h.extend(p.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Xa(a,c)?"num"+c:null},function(a){if(a&&(!Yb.test(a)||!Zb.test(a)))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||H(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return Xa(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Qb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Qb(a,c,!0)?"html-num-fmt"+c:null},function(a){return H(a)||"string"=== typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(p.ext.type.search,{html:function(a){return H(a)?a:"string"===typeof a?a.replace(Nb," ").replace(wa,""):""},string:function(a){return H(a)?a:"string"===typeof a?a.replace(Nb," "):a}});h.extend(!0,p.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass)}})},jqueryui:function(a, b,c,d){var e=c.idx;h("
").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(f,g,h,i){if(a===g){b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(i[e]=="asc"?d.sSortAsc:i[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(i[e]=="asc"?d.sSortJUIAsc: i[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});p.render={number:function(a,b,c,d){return{display:function(e){var f=0>e?"-":"",e=Math.abs(parseFloat(e)),g=parseInt(e,10),e=c?b+(e-g).toFixed(c).substring(2):"";return f+(d||"")+g.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+e}}}};h.extend(p.ext.internal,{_fnExternApiFunc:Mb,_fnBuildAjax:na,_fnAjaxUpdate:jb,_fnAjaxParameters:sb,_fnAjaxUpdateDraw:tb,_fnAjaxDataSrc:oa,_fnAddColumn:Aa,_fnColumnOptions:fa,_fnAdjustColumnSizing:V,_fnVisibleToColumnIndex:ga, _fnColumnIndexToVisible:Y,_fnVisbleColumns:Z,_fnGetColumns:X,_fnColumnTypes:Da,_fnApplyColumnDefs:hb,_fnHungarianMap:T,_fnCamelToHungarian:G,_fnLanguageCompat:N,_fnBrowserDetect:fb,_fnAddData:I,_fnAddTr:ha,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==l?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:A,_fnSetCellData:Ea,_fnSplitObjNotation:Ga,_fnGetObjectDataFn:U,_fnSetObjectDataFn:Ba,_fnGetDataMaster:Ha,_fnClearTable:ja, _fnDeleteIndex:ka,_fnInvalidateRow:la,_fnGetRowElements:ia,_fnCreateTr:Fa,_fnBuildHead:ib,_fnDrawHead:ba,_fnDraw:K,_fnReDraw:L,_fnAddOptionsHtml:lb,_fnDetectHeader:aa,_fnGetUniqueThs:ma,_fnFeatureHtmlFilter:nb,_fnFilterComplete:ca,_fnFilterCustom:wb,_fnFilterColumn:vb,_fnFilter:ub,_fnFilterCreateSearch:Na,_fnEscapeRegex:Oa,_fnFilterData:xb,_fnFeatureHtmlInfo:qb,_fnUpdateInfo:Ab,_fnInfoMacros:Bb,_fnInitialise:ra,_fnInitComplete:pa,_fnLengthChange:Pa,_fnFeatureHtmlLength:mb,_fnFeatureHtmlPaginate:rb, _fnPageChange:Ra,_fnFeatureHtmlProcessing:ob,_fnProcessingDisplay:B,_fnFeatureHtmlTable:pb,_fnScrollDraw:W,_fnApplyToChildren:F,_fnCalculateColumnWidths:Ca,_fnThrottle:Ma,_fnConvertToWidth:Cb,_fnScrollingWidthAdjust:Eb,_fnGetWidestNode:Db,_fnGetMaxLenString:Fb,_fnStringToCss:s,_fnScrollBarWidth:Gb,_fnSortFlatten:R,_fnSort:kb,_fnSortAria:Ib,_fnSortListener:Sa,_fnSortAttachListener:Ka,_fnSortingClasses:sa,_fnSortData:Hb,_fnSaveState:ta,_fnLoadState:Jb,_fnSettingsFromNode:ua,_fnLog:P,_fnMap:D,_fnBindAction:Ta, _fnCallbackReg:x,_fnCallbackFire:u,_fnLengthOverflow:Qa,_fnRenderer:La,_fnDataSource:z,_fnRowAttributes:Ia,_fnCalculateEnd:function(){}});h.fn.dataTable=p;h.fn.dataTableSettings=p.settings;h.fn.dataTableExt=p.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(p,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable};"function"===typeof define&&define.amd?define("datatables",["jquery"],N):"object"===typeof exports?N(require("jquery")):jQuery&&!jQuery.fn.dataTable&&N(jQuery)})(window, document); /*global $, jQuery, exFilterColumn*/ /*jslint plusplus: true, nomen: true */ /*! * Yet Another DataTables Column Filter - (yadcf) * * File: jquery.dataTables.yadcf.js * Version: 0.8.3 * * Author: Daniel Reznick * Info: https://github.com/vedmack/yadcf * Contact: vedmack@gmail.com * Twitter: @danielreznick * Q&A https://groups.google.com/forum/#!forum/daniels_code * * Copyright 2013 Daniel Reznick, all rights reserved. * Dual licensed under two licenses: GPL v2 license or a BSD (3-point) license (just like DataTables itself) * * This source file is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. */ /* * Parameters: * * * ------------- * column_number Required: true Type: String Description: The number of the column to which the filter will be applied * filter_type Required: false Type: String Default value: select Possible values: select / multi_select / auto_complete / text / date / range_number / range_number_slider / range_date / custom_func Description: The type of the filter to be used in the column * custom_func Required: true (when filter_type is custom_func) Type: function Default value: undefined Description: should be pointing to a function with the following signature myCustomFilterFunction(filterVal, columnVal) , where filterVal is the value from the select box and columnVal is the value from the relevant row column, this function should return true if teh row matches your condition and the row should be displayed) and false otherwise * data Required: false / true (when filter_type is custom_func) Type: Array (of string or objects) Description: When the need of predefined data for filter is needed just use an array of strings ["value1","value2"....] (supported in select / multi_select / auto_complete filters) or array of objects [{value: 'Some Data 1', label: 'One'}, {value: 'Some Data 3', label: 'Three'}] (supported in select / multi_select filters) Note: that when filter_type is custom_func this array will populate the custom filter select element * column_data_type Required: false Type: String Default value: text Possible values: text / html Description: The type of data in column , use "html" when you have some html code in the column (support parsing of multiple elements per cell) * text_data_delimiter Required: false Type: String Description: Delimiter that seperates text in table column, for example text_data_delimiter: "," * html_data_type Required: false Type: String Default value: text Possible values: text / value / id Description: When using "html" for column_data_type argument you can choose how exactly to parse your html element/s in column , for example use "text" for the following Some text * filter_container_id Required: false Type: String Description: In case that user don't want to place the filter in column header , he can pass an id of the desired container for the column filter * filter_default_label Required: false Type: String / Array of string in case of range_number filter (first entry is for the first input and the second entry is for the second input Default value: Select value Description: The label that will appear in the select menu filter when no value is selected from the filter * filter_reset_button_text Required: false Type: String / boolean Default value: x Description: The text that will appear inside the reset button next to the select drop down (set this to false (boolean) in order to hide it from that column filter) * enable_auto_complete (this attribute is deprecated , and will become obsolete in the future , so you better start using filter_type: "auto_complete") Required: false Type: boolean Default value: false Description: Turns the filter into an autocomplete input - make use of the jQuery UI Autocomplete widget (with some enhancements) * sort_as Required: false Type: String Default value: alpha Possible values: alpha / num Description: Defines how the values in the filter will be sorted, alphabetically or numerically * sort_order Required: false Type: String Default value: asc Possible values: asc / desc Description: Defines the order in which the values in the filter will be sorted, ascending or descending * date_format Required: false Type: String Default value: mm/dd/yyyy Possible values: mm/dd/yyyy / dd/mm/yyyy (eventually I replace yyyy into yy for jquery datepicker) Description: Defines the format in which the date values are being parsed into Date object * ignore_char Required: false Type: String Description: Tells the range_number and range_number_slide to ignore specific char while filtering (that char can used as number separator) * filter_match_mode Required: false Type: String Default value: contains Possible values: contains / exact / startsWith Description: Allows to control the matching mode of the filter (supported in select / auto_complete / text filters) * select_type Required: false Type: String Default value: undefined Possible values: chosen / select2 Description: Turns the simple select element into "Chosen/Select2 select" (make use of the Chosen/Select2 jQuery plugin) * select_type_options Required: false Type: Object Default value: {} Description: This parameter will be passed "as is" to the Chosen/Select2 plugin constructor * case_insensitive Required: false Type: boolean Default value: true Description: Do case-insensitive filtering (supported in select / auto_complete / text filters) * filter_delay Required: false Type: integer Default value: undefined Description: Delay filter execution for a XXX milliseconds - filter will fire XXX milliseconds after the last keyup. Special Notes: Currently supported in text / range_number / range_date filters / range_number_slider * * * * External API functions: * * * ------------- * exFilterColumn Description: Allows to trigger filter/s externally/programmatically (support ALL filter types!!!) , perfect for showing table with pre filtered columns Arguments: table_arg: (variable of the datatable), array of pairs: column number String/Object with from and to, filter_value (the actual string value that we want to filter by) Usage Example: yadcf.exFilterColumn(oTable, [[0, 'Some Data 2']]); //pre filter one column yadcf.exFilterColumn(oTable, [[0, 'Some Data 1'], [1, {from: 111, to: 1110}], [2, {from: "", to: "11/25/2014"}]]); //pre filter several columns * exGetColumnFilterVal Description: Allows to retreive column current filtered value (support ALL filter types!!!) Arguments: table_arg: (variable of the datatable), column number: column number from which we want the value Usage Example: yadcf.exGetColumnFilterVal(oTable,1); Return value: String (for simple filter) / Object (for range filter) with from and to properties / Array of strings for multi_select filter * * * * Server-side processing API (see more on showcase): * * From server to client: * In order to populate the filters with data from server (select / auto_complete / range_number_slider (min and max values), you should add to your current json respond the following properties: * lets say for first column you add yadcf_data_0 filled with array of values, for column second column yadcf_data_1 and so on... * * From client to server: * Read the filtered value like this (for first column) req.getParameter("columns[0][search][value]"); <- java code , php/.Net/etc you just need to get it from the request * Range filter value will arrive delimited by -yadcf_delim- , so just split it into an array or something like this: String[] minMax = sSearch_0.split("-yadcf_delim-"); * * * ------------- * */ var yadcf = (function ($) { 'use strict'; var oTables = {}, oTablesIndex = {}, options = {}, exFilterColumnQueue = [], yadcfDelay; function getOptions(selector) { return options[selector]; } function setOptions(selector_arg, options_arg) { var tmpOptions = {}, i, j, col_num_as_int, default_options = { filter_type : "select", enable_auto_complete : false, sort_as : "alpha", sort_order : "asc", date_format : "mm/dd/yyyy", ignore_char : undefined, filter_match_mode : "contains", select_type : undefined, select_type_options : {}, case_insensitive : true }, adaptContainerCssClassImpl = function (dummy) { return ''; }; for (i = 0; i < options_arg.length; i++) { if (options_arg[i].select_type === 'select2') { default_options.select_type_options = {adaptContainerCssClass: adaptContainerCssClassImpl}; } //validate custom function required attributes if (options_arg[i].filter_type === 'custom_func') { if (options_arg[i].custom_func === undefined) { alert('You are trying to use filter_type: "custom_func" for column ' + options_arg[i].column_number + ' but there is no such custom_func attribute provided (custom_func: \"function reference goes here...\")'); return; } if (options_arg[i].data === undefined) { alert('You are trying to use filter_type: "custom_func" for column ' + options_arg[i].column_number + ' but there is no such data attribute provided (data: \"array of options goes here...\")'); return; } } col_num_as_int = +options_arg[i].column_number; tmpOptions[col_num_as_int] = $.extend(true, {}, default_options, options_arg[i]); } options[selector_arg] = tmpOptions; } function resetIApiIndex() { $.fn.dataTableExt.iApiIndex = 0; } function generateTableSelectorJQFriendly(tmpStr) { return tmpStr.replace(":", "-").replace("(", "").replace(")", "").replace(".", "-").replace("#", "-"); } yadcfDelay = (function () { var timer = 0; return function (callback, ms, param) { clearTimeout(timer); timer = setTimeout(function () { callback(param); }, ms); return timer; }; }()); //Used by exFilterColumn for translating readable search value into proper search string for datatables filtering function yadcfMatchFilterString(table_arg, column_number, selected_value, filter_match_mode, multiple) { var case_insensitive = yadcf.getOptions(table_arg.selector)[column_number].case_insensitive, ret_val; table_arg.fnSettings().aoPreSearchCols[column_number].bSmart = false; table_arg.fnSettings().aoPreSearchCols[column_number].bCaseInsensitive = case_insensitive; if (multiple === undefined || multiple === false) { if (filter_match_mode === "contains") { table_arg.fnSettings().aoPreSearchCols[column_number].bRegex = false; ret_val = selected_value; } else if (filter_match_mode === "exact") { table_arg.fnSettings().aoPreSearchCols[column_number].bRegex = true; ret_val = "^" + selected_value + "$"; } else if (filter_match_mode === "startsWith") { table_arg.fnSettings().aoPreSearchCols[column_number].bRegex = true; ret_val = "^" + selected_value; } } else { if (filter_match_mode === "contains") { table_arg.fnSettings().aoPreSearchCols[column_number].bRegex = true; ret_val = selected_value.join("|"); } else if (filter_match_mode === "exact") { table_arg.fnSettings().aoPreSearchCols[column_number].bRegex = true; ret_val = "^(" + selected_value.join("|") + ")$"; } else if (filter_match_mode === "startsWith") { table_arg.fnSettings().aoPreSearchCols[column_number].bRegex = true; ret_val = "^(" + selected_value.join("|") + ")"; } } return ret_val; } function yadcfMatchFilter(oTable, selected_value, filter_match_mode, column_number) { var case_insensitive = yadcf.getOptions(oTable.selector)[column_number].case_insensitive; if (filter_match_mode === "contains") { oTable.fnFilter(selected_value, column_number, false, false, true, case_insensitive); } else if (filter_match_mode === "exact") { oTable.fnFilter("^" + selected_value + "$", column_number, true, false, true, case_insensitive); } else if (filter_match_mode === "startsWith") { oTable.fnFilter("^" + selected_value, column_number, true, false, true, case_insensitive); } } function yadcfParseMatchFilter(tmpStr, filter_match_mode) { var retVal; if (filter_match_mode === "contains") { retVal = tmpStr; } else if (filter_match_mode === "exact") { retVal = tmpStr.substring(1, tmpStr.length - 1); } else if (filter_match_mode === "startsWith") { retVal = tmpStr.substring(1, tmpStr.length); } return retVal; } function doFilterCustomDateFunc(arg, table_selector_jq_friendly, column_number) { var oTable = oTables[table_selector_jq_friendly]; if (arg === "clear" || arg.value === "-1") { if (arg === "clear") { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("-1").focus(); } $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse"); } else { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse"); } oTable.fnDraw(); } function doFilter(arg, table_selector_jq_friendly, column_number, filter_match_mode) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], selected_value; if (arg === "clear") { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("-1").focus(); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse"); $(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", "-1"); oTable.fnFilter("", column_number); resetIApiIndex(); if (yadcf.getOptions(oTable.selector)[column_number].select_type === 'chosen') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).trigger("chosen:updated"); } return; } $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse"); $(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", arg.value); selected_value = $.trim($(arg).find('option:selected').val()); if (arg.value !== "-1") { yadcfMatchFilter(oTable, selected_value, filter_match_mode, column_number); } else { oTable.fnFilter("", column_number); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse"); } resetIApiIndex(); } function doFilterMultiSelect(arg, table_selector_jq_friendly, column_number, filter_match_mode) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], aEscapedTerms = [], selected_values = $(arg).val(), i, stringForSearch; $(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", selected_values); if (selected_values !== null) { for (i = selected_values.length - 1; i >= 0; i--) { if (selected_values[i] === "-1") { selected_values.splice(i, 1); break; } } if (selected_values.length !== 0) { stringForSearch = selected_values.join("|"); stringForSearch = stringForSearch.replace(/([.*+?^=!:${}()\[\]\/\\])/g, "\\$1"); if (filter_match_mode === "contains") { oTable.fnFilter(stringForSearch, column_number, true, false, true); } else if (filter_match_mode === "exact") { oTable.fnFilter("^(" + stringForSearch + ")$", column_number, true, false, true); } else if (filter_match_mode === "startsWith") { oTable.fnFilter("^(" + stringForSearch + ")", column_number, true, false, true); } } else { oTable.fnFilter("", column_number); } } else { oTable.fnFilter("", column_number); } resetIApiIndex(); } function yadcfParseMatchFilterMultiSelect(tmpStr, filter_match_mode) { var retVal; if (filter_match_mode === "contains") { retVal = tmpStr; } else if (filter_match_mode === "exact") { retVal = tmpStr.substring(1, tmpStr.length - 1); retVal = retVal.substring(1, retVal.length - 1); } else if (filter_match_mode === "startsWith") { retVal = tmpStr.substring(1, tmpStr.length); retVal = retVal.substring(1, retVal.length - 1); } return retVal; } function doFilterAutocomplete(arg, table_selector_jq_friendly, column_number, filter_match_mode) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly]; if (arg === "clear") { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("").focus(); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse"); $(document).removeData("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val"); oTable.fnFilter("", column_number); resetIApiIndex(); return; } $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse"); $(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", arg.value); yadcfMatchFilter(oTable, arg.value, filter_match_mode, column_number); resetIApiIndex(); } function autocompleteSelect(event, ui) { var table_column = event.target.id.replace("yadcf-filter-", ""), dashIndex = table_column.lastIndexOf("-"), table_selector_jq_friendly = table_column.substring(0, dashIndex), col_num = parseInt(table_column.substring(dashIndex + 1), 10), filter_match_mode = $(event.target).attr("filter_match_mode"); doFilterAutocomplete(ui.item, table_selector_jq_friendly, col_num, filter_match_mode); } function sortNumAsc(a, b) { return a - b; } function sortNumDesc(a, b) { return b - a; } function findMinInArray(array, ignore_char) { var narray = [], i; for (i = 0; i < array.length; i++) { if (array[i] !== null) { if (ignore_char !== undefined) { array[i] = array[i].toString().replace(ignore_char, ""); } narray.push(array[i]); } } return Math.min.apply(Math, narray); } function findMaxInArray(array, ignore_char) { var narray = [], i; for (i = 0; i < array.length; i++) { if (array[i] !== null) { if (ignore_char !== undefined) { array[i] = array[i].toString().replace(ignore_char, ""); } narray.push(array[i]); } } return Math.max.apply(Math, narray); } function addRangeNumberFilterCapability(table_selector_jq_friendly, fromId, toId, col_num, ignore_char) { $.fn.dataTableExt.afnFiltering.push( function (oSettings, aData, iDataIndex) { var min = document.getElementById(fromId).value, max = document.getElementById(toId).value, val = aData[col_num] === "-" ? 0 : aData[col_num], retVal = false, table_selector_jq_friendly_local = table_selector_jq_friendly, current_table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(oSettings.oInstance.selector), ignore_char_local = ignore_char; if (table_selector_jq_friendly_local !== current_table_selector_jq_friendly) { return true; } if (ignore_char_local !== undefined) { min = min.replace(ignore_char_local, ""); max = max.replace(ignore_char_local, ""); val = val.toString().replace(ignore_char_local, ""); } min = (min !== "") ? (+min) : min; max = (max !== "") ? (+max) : max; val = (val !== "") ? (+val) : val; if (min === "" && max === "") { retVal = true; } else if (min === "" && val <= max) { retVal = true; } else if (min <= val && "" === max) { retVal = true; } else if (min <= val && val <= max) { retVal = true; } return retVal; } ); } function addCustomFunctionFilterCapability(table_selector_jq_friendly, filterId, col_num) { $.fn.dataTableExt.afnFiltering.push( function (oSettings, aData, iDataIndex) { var filterVal = document.getElementById(filterId) !== null ? document.getElementById(filterId).value : "", columnVal = aData[col_num] === "-" ? 0 : aData[col_num], retVal = false, table_selector_jq_friendly_local = table_selector_jq_friendly, current_table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(oSettings.oInstance.selector), custom_func; if (table_selector_jq_friendly_local !== current_table_selector_jq_friendly) { return true; } custom_func = yadcf.getOptions(oSettings.oInstance.selector)[col_num].custom_func; retVal = custom_func(filterVal, columnVal); return retVal; } ); } function addRangeDateFilterCapability(table_selector_jq_friendly, fromId, toId, col_num, date_format) { $.fn.dataTableExt.afnFiltering.push( function (oSettings, aData, iDataIndex) { var min = document.getElementById(fromId) !== null ? document.getElementById(fromId).value : "", max = document.getElementById(toId) !== null ? document.getElementById(toId).value : "", val = aData[col_num] === "-" ? 0 : aData[col_num], retVal = false, table_selector_jq_friendly_local = table_selector_jq_friendly, current_table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(oSettings.oInstance.selector); if (table_selector_jq_friendly_local !== current_table_selector_jq_friendly) { return true; } try { if (min.length === (date_format.length + 2)) { min = (min !== "") ? $.datepicker.parseDate(date_format, min) : min; } } catch (err1) {} try { if (max.length === (date_format.length + 2)) { max = (max !== "") ? $.datepicker.parseDate(date_format, max) : max; } } catch (err2) {} try { val = (val !== "") ? $.datepicker.parseDate(date_format, val) : val; } catch (err3) {} if ((min === "" || !(min instanceof Date)) && (max === "" || !(max instanceof Date))) { retVal = true; } else if (min === "" && val <= max) { retVal = true; } else if (min <= val && "" === max) { retVal = true; } else if (min <= val && val <= max) { retVal = true; } return retVal; } ); } function addRangeNumberSliderFilterCapability(table_selector_jq_friendly, fromId, toId, col_num, ignore_char) { $.fn.dataTableExt.afnFiltering.push( function (oSettings, aData, iDataIndex) { var min = $('#' + fromId).text(), max = $('#' + toId).text(), val = aData[col_num] === "-" ? 0 : aData[col_num], retVal = false, table_selector_jq_friendly_local = table_selector_jq_friendly, current_table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(oSettings.oInstance.selector), ignore_char_local = ignore_char, column_data_type, html_data_type, i, columnObjKey; if (table_selector_jq_friendly_local !== current_table_selector_jq_friendly) { return true; } if (!isFinite(min) || !isFinite(max)) { return true; } column_data_type = yadcf.getOptions(oSettings.oInstance.selector)[col_num].column_data_type; html_data_type = yadcf.getOptions(oSettings.oInstance.selector)[col_num].html_data_type; if (column_data_type === "html") { if (html_data_type === undefined) { html_data_type = "text"; } switch (html_data_type) { case "text": val = $(val).text(); break; case "value": val = $(val).val(); break; case "id": val = val.id; break; } } if (ignore_char_local !== undefined) { min = min.replace(ignore_char_local, ""); max = max.replace(ignore_char_local, ""); val = val.toString().replace(ignore_char_local, ""); } min = (min !== "") ? (+min) : min; max = (max !== "") ? (+max) : max; val = (val !== "") ? (+val) : val; if (min === "" && max === "") { retVal = true; } else if (min === "" && val <= max) { retVal = true; } else if (min <= val && "" === max) { retVal = true; } else if (min <= val && val <= max) { retVal = true; } return retVal; } ); } function addRangeNumberFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, ignore_char) { var fromId = "yadcf-filter-" + table_selector_jq_friendly + "-from-" + column_number, toId = "yadcf-filter-" + table_selector_jq_friendly + "-to-" + column_number, filter_selector_string_tmp, filter_wrapper_id, oTable; filter_wrapper_id = "yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number; if ($("#" + filter_wrapper_id).length > 0) { return; } //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; filter_selector_string_tmp = filter_selector_string; $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper-inner"; $(filter_selector_string).append("" + ""); $(filter_selector_string).append("" + ""); $(filter_selector_string).append("" + ""); if (filter_reset_button_text !== false) { $(filter_selector_string_tmp).append(""); } $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; if (oTable.fnSettings().oFeatures.bStateSave === true && oTable.fnSettings().oLoadedState) { if (oTable.fnSettings().oLoadedState.yadcfState && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]) { $('#' + fromId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from); if (oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from !== "") { $('#' + fromId).addClass("inuse"); } $('#' + toId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to); if (oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to !== "") { $('#' + toId).addClass("inuse"); } } } resetIApiIndex(); if (oTable.fnSettings().oFeatures.bServerSide !== true) { addRangeNumberFilterCapability(table_selector_jq_friendly, fromId, toId, column_number, ignore_char); } } function dateSelectSingle(date, event, clear) { var oTable, column_number = $(event).attr('id').replace('yadcf-filter-', '').replace('-date', '').replace('-reset', ''), dashIndex = column_number.lastIndexOf("-"), table_selector_jq_friendly = column_number.substring(0, dashIndex), date_str; column_number = column_number.substring(dashIndex + 1); $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; if (clear === undefined) { date_str = document.getElementById($(event).attr('id')).value; oTable.fnFilter(date, column_number); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).addClass("inuse"); } else if (clear === 'clear') { oTable.fnFilter('', column_number); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val('').removeClass("inuse"); } resetIApiIndex(); } function dateSelect(date, event) { var oTable, column_number = $(event).attr("id").replace("yadcf-filter-", "").replace("-from-date", "").replace("-to-date", ""), dashIndex = column_number.lastIndexOf("-"), table_selector_jq_friendly = column_number.substring(0, dashIndex), yadcfState, from, to, min, max, min_server, max_server, date_format; column_number = column_number.substring(dashIndex + 1); $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; date_format = yadcf.getOptions(oTable.selector)[column_number].date_format; date_format = date_format.replace("yyyy", "yy"); $("#" + $(event).attr("id")).addClass("inuse"); if ($(event).attr("id").indexOf("-from-") !== -1) { from = document.getElementById($(event).attr("id")).value; to = document.getElementById($(event).attr("id").replace("-from-", "-to-")).value; } else { to = document.getElementById($(event).attr("id")).value; from = document.getElementById($(event).attr("id").replace("-to-", "-from-")).value; } if (oTable.fnSettings().oFeatures.bServerSide !== true) { oTable.fnDraw(); } else { min = from; max = to; try { if (min.length === (date_format.length + 2)) { min = (min !== "") ? $.datepicker.parseDate(date_format, min) : min; } } catch (err1) {} try { if (max.length === (date_format.length + 2)) { max = (max !== "") ? $.datepicker.parseDate(date_format, max) : max; } } catch (err2) {} if (min instanceof Date) { min_server = min.getTime(); } else { min_server = min; } if (max instanceof Date) { max_server = max.getTime(); } else { max_server = max; } oTable.fnFilter(min_server + '-yadcf_delim-' + max_server, column_number); } if (!oTable.fnSettings().oLoadedState) { oTable.fnSettings().oLoadedState = {}; oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } if (oTable.fnSettings().oFeatures.bStateSave === true) { if (oTable.fnSettings().oLoadedState.yadcfState !== undefined && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] !== undefined) { oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] = { 'from' : from, 'to' : to }; } else { yadcfState = {}; yadcfState[table_selector_jq_friendly] = []; yadcfState[table_selector_jq_friendly][column_number] = { 'from' : from, 'to' : to }; oTable.fnSettings().oLoadedState.yadcfState = yadcfState; } oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } resetIApiIndex(); } function addRangeDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format) { var fromId = "yadcf-filter-" + table_selector_jq_friendly + "-from-date-" + column_number, toId = "yadcf-filter-" + table_selector_jq_friendly + "-to-date-" + column_number, filter_selector_string_tmp, filter_wrapper_id, oTable; filter_wrapper_id = "yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number; if ($("#" + filter_wrapper_id).length > 0) { return; } //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; filter_selector_string_tmp = filter_selector_string; $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper-inner"; $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; $(filter_selector_string).append("" + ""); $(filter_selector_string).append("" + ""); $(filter_selector_string).append("" + ""); if (filter_reset_button_text !== false) { $(filter_selector_string_tmp).append(""); } $("#" + fromId).datepicker({ dateFormat: date_format, onSelect: dateSelect }); $("#" + toId).datepicker({ dateFormat: date_format, onSelect: dateSelect }); if (oTable.fnSettings().oFeatures.bStateSave === true && oTable.fnSettings().oLoadedState) { if (oTable.fnSettings().oLoadedState.yadcfState && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]) { $('#' + fromId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from); if (oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from !== "") { $('#' + fromId).addClass("inuse"); } $('#' + toId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to); if (oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to !== "") { $('#' + toId).addClass("inuse"); } } } if (oTable.fnSettings().oFeatures.bServerSide !== true) { addRangeDateFilterCapability(table_selector_jq_friendly, fromId, toId, column_number, date_format); } resetIApiIndex(); } function addDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format) { var dateId = "yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, filter_selector_string_tmp, filter_wrapper_id, oTable; filter_wrapper_id = "yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number; if ($("#" + filter_wrapper_id).length > 0) { return; } //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; filter_selector_string_tmp = filter_selector_string; $(filter_selector_string).append(""); if (filter_reset_button_text !== false) { $(filter_selector_string_tmp).append(''); } $("#" + dateId).datepicker({ dateFormat: date_format, onSelect: dateSelectSingle }); $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; if (oTable.fnSettings().aoPreSearchCols[column_number].sSearch !== '') { $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(oTable.fnSettings().aoPreSearchCols[column_number].sSearch).addClass("inuse"); } resetIApiIndex(); } function rangeNumberSldierDrawTips(min_tip_val, max_tip_val, min_tip_id, max_tip_id, table_selector_jq_friendly, column_number) { var first_handle = $("#yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + " .ui-slider-handle:first"), last_handle = $("#yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + " .ui-slider-handle:last"), min_tip_inner, max_tip_inner; min_tip_inner = "
" + min_tip_val + "
"; max_tip_inner = "
" + max_tip_val + "
"; $(first_handle).addClass("yadcf-filter-range-number-slider-min-tip").html(min_tip_inner); $(last_handle).addClass("yadcf-filter-range-number-slider-max-tip").html(max_tip_inner); } function rangeNumberSliderChange(table_selector_jq_friendly, event, ui) { var oTable, min_val, max_val, slider_inuse, yadcfState, column_number = $(event.target).attr('id').replace("yadcf-filter-", "").replace(table_selector_jq_friendly, "").replace("-slider-", ""), options, keyUp; oTable = oTables[table_selector_jq_friendly]; options = getOptions(oTable.selector)[column_number]; keyUp = function () { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; if (oTable.fnSettings().oFeatures.bServerSide !== true) { oTable.fnDraw(); } else { oTable.fnFilter(ui.values[0] + '-yadcf_delim-' + ui.values[1], column_number); } min_val = +$($(event.target).parent().find(".yadcf-filter-range-number-slider-min-tip-hidden")).text(); max_val = +$($(event.target).parent().find(".yadcf-filter-range-number-slider-max-tip-hidden")).text(); if (min_val !== ui.values[0]) { $($(event.target).find(".ui-slider-handle")[0]).addClass("inuse"); slider_inuse = true; } else { $($(event.target).find(".ui-slider-handle")[0]).removeClass("inuse"); } if (max_val !== ui.values[1]) { $($(event.target).find(".ui-slider-handle")[1]).addClass("inuse"); slider_inuse = true; } else { $($(event.target).find(".ui-slider-handle")[1]).removeClass("inuse"); } if (slider_inuse === true) { $(event.target).find(".ui-slider-range").addClass("inuse"); } else { $(event.target).find(".ui-slider-range").removeClass("inuse"); } if (!oTable.fnSettings().oLoadedState) { oTable.fnSettings().oLoadedState = {}; oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } if (oTable.fnSettings().oFeatures.bStateSave === true) { if (oTable.fnSettings().oLoadedState.yadcfState !== undefined && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] !== undefined) { oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] = { 'from' : ui.values[0], 'to' : ui.values[1] }; } else { yadcfState = {}; yadcfState[table_selector_jq_friendly] = []; yadcfState[table_selector_jq_friendly][column_number] = { 'from' : ui.values[0], 'to' : ui.values[1] }; oTable.fnSettings().oLoadedState.yadcfState = yadcfState; } oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } resetIApiIndex(); }; if (options.filter_delay === undefined) { keyUp(); } else { yadcfDelay(function () { keyUp(); }, options.filter_delay); } } function addRangeNumberSliderFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, min_val, max_val, ignore_char) { var sliderId = "yadcf-filter-" + table_selector_jq_friendly + "-slider-" + column_number, min_tip_id = "yadcf-filter-" + table_selector_jq_friendly + "-min_tip-" + column_number, max_tip_id = "yadcf-filter-" + table_selector_jq_friendly + "-max_tip-" + column_number, filter_selector_string_tmp, filter_wrapper_id, oTable, min_state_val = min_val, max_state_val = max_val; filter_wrapper_id = "yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number; if ($("#" + filter_wrapper_id).length > 0) { if (!isFinite($('#' + min_tip_id).text()) || !isFinite($('#' + max_tip_id).text()) || !isFinite(min_val) || !isFinite(max_val) || !isFinite($(filter_selector_string).find('.yadcf-filter-range-number-slider-min-tip-hidden.hide').text()) || !isFinite($(filter_selector_string).find('.yadcf-filter-range-number-slider-max-tip-hidden.hide').text())) { $(filter_selector_string).empty(); } else { return; } } //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; filter_selector_string_tmp = filter_selector_string; $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-number-slider-filter-wrapper-inner"; $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " #" + sliderId; $(filter_selector_string).append("" + min_val + ""); $(filter_selector_string).append("" + max_val + ""); $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; if (oTable.fnSettings().oFeatures.bStateSave === true && oTable.fnSettings().oLoadedState) { if (oTable.fnSettings().oLoadedState.yadcfState && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]) { if (min_val !== oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from) { min_state_val = oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from; } if (max_val !== oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to) { max_state_val = oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to; } } } if (isFinite(min_val) && isFinite(max_val) && isFinite(min_state_val) && isFinite(max_state_val)) { $("#" + sliderId).slider({ range: true, min: min_val, max: max_val, values: [min_state_val, max_state_val], create: function (event, ui) { rangeNumberSldierDrawTips(min_state_val, max_state_val, min_tip_id, max_tip_id, table_selector_jq_friendly, column_number); }, slide: function (event, ui) { rangeNumberSldierDrawTips(ui.values[0], ui.values[1], min_tip_id, max_tip_id, table_selector_jq_friendly, column_number); rangeNumberSliderChange(table_selector_jq_friendly, event, ui); }, change: function (event, ui) { rangeNumberSldierDrawTips(ui.values[0], ui.values[1], min_tip_id, max_tip_id, table_selector_jq_friendly, column_number); rangeNumberSliderChange(table_selector_jq_friendly, event, ui); } }); if (filter_reset_button_text !== false) { $(filter_selector_string_tmp).append(""); } } $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; if (oTable.fnSettings().oFeatures.bStateSave === true && oTable.fnSettings().oLoadedState) { if (oTable.fnSettings().oLoadedState.yadcfState && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]) { if (isFinite(min_val) && min_val !== oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from) { $($(filter_selector_string).find(".ui-slider-handle")[0]).addClass("inuse"); } if (isFinite(max_val) && max_val !== oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to) { $($(filter_selector_string).find(".ui-slider-handle")[1]).addClass("inuse"); } if ((isFinite(min_val) && isFinite(max_val)) && (min_val !== oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from || max_val !== oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to)) { $($(filter_selector_string).find(".ui-slider-range")).addClass("inuse"); } } } resetIApiIndex(); if (oTable.fnSettings().oFeatures.bServerSide !== true) { addRangeNumberSliderFilterCapability(table_selector_jq_friendly, min_tip_id, max_tip_id, column_number, ignore_char); } } function dot2obj(tmpObj, dot_refs) { var i = 0; dot_refs = dot_refs.split("."); for (i = 0; i < dot_refs.length; i++) { tmpObj = tmpObj[dot_refs[i]]; } return tmpObj; } function appendFilters(oTable, args, table_selector) { var i = 0, $filter_selector, filter_selector_string, data, filter_container_id, column_number_data, column_number, column_data_type, html_data_type, text_data_delimiter, filter_default_label, filter_reset_button_text, enable_auto_complete, sort_as, sort_order, date_format, ignore_char, filter_match_mode, options, options_tmp, j, k, data_length, col_inner_elements, col_inner_data, col_filter_array, ii, table_selector_jq_friendly, min_val, max_val, col_num_visible, col_num_visible_iter, tmpStr, columnObjKey, columnObj; for (columnObjKey in args) { if (args.hasOwnProperty(columnObjKey)) { columnObj = args[columnObjKey]; data = columnObj.data; filter_container_id = columnObj.filter_container_id; column_number = columnObj.column_number; column_number = +column_number; column_number_data = undefined; if (isNaN(oTable.fnSettings().aoColumns[column_number].mData) && typeof oTable.fnSettings().aoColumns[column_number].mData !== 'object') { column_number_data = oTable.fnSettings().aoColumns[column_number].mData; } column_data_type = columnObj.column_data_type; html_data_type = columnObj.html_data_type; text_data_delimiter = columnObj.text_data_delimiter; filter_default_label = columnObj.filter_default_label; filter_reset_button_text = columnObj.filter_reset_button_text; enable_auto_complete = columnObj.enable_auto_complete; sort_as = columnObj.sort_as; sort_order = columnObj.sort_order; date_format = columnObj.date_format; //for jquery datepicker date_format = date_format.replace("yyyy", "yy"); if (columnObj.ignore_char !== undefined) { ignore_char = new RegExp(columnObj.ignore_char, "g"); } filter_match_mode = columnObj.filter_match_mode; if (column_number === undefined) { alert("You must specify column number"); return; } if (column_data_type === undefined) { column_data_type = "text"; } else if (column_data_type === "html") { if (html_data_type === undefined) { html_data_type = "text"; } } if (enable_auto_complete === true) { columnObj.filter_type = "auto_complete"; } if (filter_default_label === undefined) { if (columnObj.filter_type === "select" || columnObj.filter_type === 'custom_func') { filter_default_label = "Select value"; } else if (columnObj.filter_type === "multi_select") { filter_default_label = "Select values"; } else if (columnObj.filter_type === "auto_complete" || columnObj.filter_type === "text") { filter_default_label = "Type a value"; } else if (columnObj.filter_type === "range_number" || columnObj.filter_type === "range_date") { filter_default_label = ["from", "to"]; } else if (columnObj.filter_type === "date") { filter_default_label = "Select a date"; } } if (filter_reset_button_text === undefined) { filter_reset_button_text = "x"; } options = []; col_filter_array = {}; if (data === undefined) { data = oTable.fnSettings().aoData; data_length = data.length; for (j = 0; j < data_length; j++) { if (column_data_type === "html") { if (column_number_data === undefined) { col_inner_elements = $(data[j]._aData[column_number]); } else { col_inner_elements = dot2obj(data[j]._aData, column_number_data); col_inner_elements = $(col_inner_elements); } for (k = 0; k < col_inner_elements.length; k++) { switch (html_data_type) { case "text": col_inner_data = $(col_inner_elements[k]).text(); break; case "value": col_inner_data = $(col_inner_elements[k]).val(); break; case "id": col_inner_data = col_inner_elements[k].id; break; } if (!(col_filter_array.hasOwnProperty(col_inner_data))) { col_filter_array[col_inner_data] = col_inner_data; options.push(col_inner_data); } } } else if (column_data_type === "text") { if (text_data_delimiter !== undefined) { if (column_number_data === undefined) { col_inner_elements = data[j]._aData[column_number].split(text_data_delimiter); } else { col_inner_elements = dot2obj(data[j]._aData, column_number_data); col_inner_elements = col_inner_elements.split(text_data_delimiter); } for (k = 0; k < col_inner_elements.length; k++) { col_inner_data = col_inner_elements[k]; if (!(col_filter_array.hasOwnProperty(col_inner_data))) { col_filter_array[col_inner_data] = col_inner_data; options.push(col_inner_data); } } } else { if (column_number_data === undefined) { col_inner_data = data[j]._aData[column_number]; } else { col_inner_data = dot2obj(data[j]._aData, column_number_data); } if (!(col_filter_array.hasOwnProperty(col_inner_data))) { col_filter_array[col_inner_data] = col_inner_data; options.push(col_inner_data); } } } } } else { for (ii = 0; ii < data.length; ii++) { options.push(data[ii]); } } if (columnObj.filter_type === "range_number_slider") { min_val = findMinInArray(options, ignore_char); max_val = findMaxInArray(options, ignore_char); } if (filter_container_id === undefined) { //Can't show filter inside a column for a hidden one (place it outside using filter_container_id) if (oTable.fnSettings().aoColumns[column_number].bVisible === false) { //console.log('Yadcf warning: Can\'t show filter inside a column N#' + column_number + ' for a hidden one (place it outside using filter_container_id)'); continue; } col_num_visible = column_number; for (col_num_visible_iter = 0; col_num_visible_iter < oTable.fnSettings().aoColumns.length && col_num_visible_iter < column_number; col_num_visible_iter++) { if (oTable.fnSettings().aoColumns[col_num_visible_iter].bVisible === false) { col_num_visible--; } } filter_selector_string = table_selector + " thead th:eq(" + col_num_visible + ")"; $filter_selector = $(filter_selector_string).find(".yadcf-filter"); } else { if ($("#" + filter_container_id).length === 0) { alert("Filter container could not be found."); return; } filter_selector_string = "#" + filter_container_id; $filter_selector = $(filter_selector_string).find(".yadcf-filter"); } table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(table_selector); if (columnObj.filter_type === "select" || columnObj.filter_type === "auto_complete" || columnObj.filter_type === "multi_select" || columnObj.filter_type === "custom_func") { if (sort_as === "alpha") { if (sort_order === "asc") { options.sort(); } else if (sort_order === "desc") { options.sort(); options.reverse(); } } else if (sort_as === "num") { if (sort_order === "asc") { options.sort(sortNumAsc); } else if (sort_order === "desc") { options.sort(sortNumDesc); } } } if (columnObj.filter_type === "select" || columnObj.filter_type === 'custom_func') { options_tmp = ""; if (typeof options[0] === 'object') { for (ii = 0; ii < options.length; ii++) { options_tmp += ""; } } else { for (ii = 0; ii < options.length; ii++) { options_tmp += ""; } } options = options_tmp; } else if (columnObj.filter_type === "multi_select") { if (columnObj.select_type === undefined) { options_tmp = ""; } else { options_tmp = ""; } if (typeof options[0] === 'object') { for (ii = 0; ii < options.length; ii++) { options_tmp += ""; } } else { for (ii = 0; ii < options.length; ii++) { options_tmp += ""; } } options = options_tmp; } if ($filter_selector.length === 1) { if (columnObj.filter_type === "select" || columnObj.filter_type === "multi_select") { $filter_selector.empty(); $filter_selector.append(options); if (oTable.fnSettings().aoPreSearchCols[column_number].sSearch !== '') { tmpStr = oTable.fnSettings().aoPreSearchCols[column_number].sSearch; if (columnObj.filter_type === "select") { tmpStr = yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse"); } else if (columnObj.filter_type === "multi_select") { tmpStr = yadcfParseMatchFilterMultiSelect(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode); tmpStr = tmpStr.replace(/\\/g, ""); tmpStr = tmpStr.split("|"); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr); } } if (columnObj.select_type !== undefined && columnObj.select_type === 'chosen') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).trigger("chosen:updated"); } else if (columnObj.select_type !== undefined && columnObj.select_type === 'select2') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).select2("destroy").select2(columnObj.select_type_options); } } else if (columnObj.filter_type === "auto_complete") { $(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, options); } } else { if (filter_container_id === undefined) { if ($(filter_selector_string + " div.DataTables_sort_wrapper").length > 0) { $(filter_selector_string + " div.DataTables_sort_wrapper").css("display", "inline-block"); } } else { if ($("#yadcf-filter-wrapper-" + filter_container_id).length === 0) { $("#" + filter_container_id).append("
"); } filter_selector_string = "#yadcf-filter-wrapper-" + filter_container_id; } if (columnObj.filter_type === "select" || columnObj.filter_type === 'custom_func') { //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; if (columnObj.filter_type === "select") { $(filter_selector_string).append(""); if (filter_reset_button_text !== false) { $(filter_selector_string).find(".yadcf-filter").after(""); } } else { $(filter_selector_string).append(""); if (filter_reset_button_text !== false) { $(filter_selector_string).find(".yadcf-filter").after(""); } if (oTable.fnSettings().oFeatures.bServerSide !== true) { addCustomFunctionFilterCapability(table_selector_jq_friendly, "yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, column_number); } } if (oTable.fnSettings().aoPreSearchCols[column_number].sSearch !== '') { tmpStr = oTable.fnSettings().aoPreSearchCols[column_number].sSearch; tmpStr = yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse"); } if (columnObj.select_type !== undefined && columnObj.select_type === 'chosen') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).chosen(columnObj.select_type_options); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).next().attr("onclick", "yadcf.stopPropagation(event);"); } else if (columnObj.select_type !== undefined && columnObj.select_type === 'select2') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).select2(columnObj.select_type_options); } } else if (columnObj.filter_type === "multi_select") { //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; $(filter_selector_string).append(""); if (filter_reset_button_text !== false) { $(filter_selector_string).find(".yadcf-filter").after(""); } if (oTable.fnSettings().aoPreSearchCols[column_number].sSearch !== '') { tmpStr = oTable.fnSettings().aoPreSearchCols[column_number].sSearch; tmpStr = yadcfParseMatchFilterMultiSelect(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode); tmpStr = tmpStr.replace(/\\/g, ""); tmpStr = tmpStr.split("|"); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr); } if (columnObj.filter_container_id === undefined && columnObj.select_type_options.width === undefined) { columnObj.select_type_options = $.extend(columnObj.select_type_options, {width: $(filter_selector_string).closest("th").width() + "px"}); } if (columnObj.select_type !== undefined && columnObj.select_type === 'chosen') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).chosen(columnObj.select_type_options); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).next().attr("onclick", "yadcf.stopPropagation(event);"); } else if (columnObj.select_type !== undefined && columnObj.select_type === 'select2') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).select2(columnObj.select_type_options); } } else if (columnObj.filter_type === "auto_complete") { //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; $(filter_selector_string).append(""); $(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, options); if (filter_reset_button_text !== false) { $(filter_selector_string).find(".yadcf-filter").after(""); } } else if (columnObj.filter_type === "text") { //add a wrapper to hold both filter and reset button $(filter_selector_string).append("
"); filter_selector_string = filter_selector_string + " div.yadcf-filter-wrapper"; $(filter_selector_string).append(""); if (filter_reset_button_text !== false) { $(filter_selector_string).find(".yadcf-filter").after(""); } if (oTable.fnSettings().aoPreSearchCols[column_number].sSearch !== '') { tmpStr = oTable.fnSettings().aoPreSearchCols[column_number].sSearch; tmpStr = yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse"); } } else if (columnObj.filter_type === "date") { addDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format); } else if (columnObj.filter_type === "range_number") { addRangeNumberFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, ignore_char); } else if (columnObj.filter_type === "range_number_slider") { addRangeNumberSliderFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, min_val, max_val, ignore_char); } else if (columnObj.filter_type === "range_date") { addRangeDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format); } } if ($(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val") !== undefined && $(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val") !== "-1") { $(filter_selector_string).find(".yadcf-filter").val($(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val")); } if (columnObj.filter_type === "auto_complete") { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).autocomplete({ source: $(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number), select: autocompleteSelect }); if (oTable.fnSettings().aoPreSearchCols[column_number].sSearch !== '') { tmpStr = oTable.fnSettings().aoPreSearchCols[column_number].sSearch; tmpStr = yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode); $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse"); } } } } if (exFilterColumnQueue.length > 0) { (exFilterColumnQueue.shift())(); } } function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } function rangeClear(table_selector_jq_friendly, event) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], yadcfState, column_number; column_number = parseInt($(event.target).parent().attr("id").replace('yadcf-filter-wrapper-' + table_selector_jq_friendly + '-', ''), 10); $(event.target).parent().find(".yadcf-filter-range").val(""); if ($(event.target).parent().find(".yadcf-filter-range-number").length > 0) { $($(event.target).parent().find(".yadcf-filter-range")[0]).focus(); } if (oTable.fnSettings().oFeatures.bServerSide !== true) { oTable.fnDraw(); } else { oTable.fnFilter('-yadcf_delim-', column_number); } if (!oTable.fnSettings().oLoadedState) { oTable.fnSettings().oLoadedState = {}; oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } if (oTable.fnSettings().oFeatures.bStateSave === true) { if (oTable.fnSettings().oLoadedState.yadcfState !== undefined && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] !== undefined) { oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] = { 'from' : "", 'to' : "" }; } else { yadcfState = {}; yadcfState[table_selector_jq_friendly] = []; yadcfState[table_selector_jq_friendly][column_number] = { 'from' : "", 'to' : "" }; oTable.fnSettings().oLoadedState.yadcfState = yadcfState; } oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } resetIApiIndex(); $(event.target).parent().find(".yadcf-filter-range").removeClass("inuse"); return; } function rangeNumberSliderClear(table_selector_jq_friendly, event) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], min_val, max_val; min_val = +$($(event.target).parent().find(".yadcf-filter-range-number-slider-min-tip-hidden")).text(); max_val = +$($(event.target).parent().find(".yadcf-filter-range-number-slider-max-tip-hidden")).text(); $("#" + $(event.target).prev().find(".yadcf-filter-range-number-slider").attr("id")).slider("option", "values", [min_val, max_val]); $($(event.target).prev().find(".ui-slider-handle")[0]).attr("tabindex", -1).focus(); $($(event.target).prev().find(".ui-slider-handle")[0]).removeClass("inuse"); $($(event.target).prev().find(".ui-slider-handle")[1]).removeClass("inuse"); $(event.target).prev().find(".ui-slider-range").removeClass("inuse"); oTable.fnDraw(); resetIApiIndex(); return; } function dateKeyUP(table_selector_jq_friendly, date_format, event) { var oTable, date, dateId, column_number; dateId = event.target.id; date = document.getElementById(dateId).value; try { if (date.length === (date_format.length + 2)) { date = (date !== "") ? $.datepicker.parseDate(date_format, date) : date; } } catch (err1) {} if (((date instanceof Date) || date === "")) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; column_number = parseInt(dateId.replace("yadcf-filter-" + table_selector_jq_friendly + "-", ""), 10); if (date instanceof Date) { $("#" + dateId).addClass('inuse'); oTable.fnFilter(document.getElementById(dateId).value, column_number); } else { $("#" + dateId).removeClass('inuse'); } if ($.trim(event.target.value) === '' && $(event.target).hasClass('inuse')) { $('#' + event.target.id).removeClass('inuse'); oTable.fnFilter('', column_number); } resetIApiIndex(); } else if ($(event.target).hasClass('inuse')) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; oTable = oTables[table_selector_jq_friendly]; column_number = parseInt(dateId.replace("yadcf-filter-" + table_selector_jq_friendly + "-", ""), 10); $("#" + dateId).removeClass('inuse'); oTable.fnFilter('', column_number); resetIApiIndex(); } } function rangeDateKeyUP(table_selector_jq_friendly, date_format, event) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], min, min_server, max, max_server, fromId, toId, column_number, options, keyUp; column_number = parseInt($(event.target).attr("id").replace('-from-date-', '').replace('-to-date-', '').replace('yadcf-filter-' + table_selector_jq_friendly, ''), 10); options = getOptions(oTable.selector)[column_number]; keyUp = function () { if (event.target.id.indexOf("-from-") !== -1) { fromId = event.target.id; toId = event.target.id.replace("-from-", "-to-"); min = document.getElementById(fromId).value; max = document.getElementById(toId).value; } else { toId = event.target.id; fromId = event.target.id.replace("-to-", "-from-"); max = document.getElementById(toId).value; min = document.getElementById(fromId).value; } try { if (min.length === (date_format.length + 2)) { min = (min !== "") ? $.datepicker.parseDate(date_format, min) : min; } } catch (err1) {} try { if (max.length === (date_format.length + 2)) { max = (max !== "") ? $.datepicker.parseDate(date_format, max) : max; } } catch (err2) {} if (((max instanceof Date) && (min instanceof Date) && (max >= min)) || min === "" || max === "") { if (oTable.fnSettings().oFeatures.bServerSide !== true) { oTable.fnDraw(); } else { if (min instanceof Date) { min_server = min.getTime(); } else { min_server = min; } if (max instanceof Date) { max_server = max.getTime(); } else { max_server = max; } oTable.fnFilter(min_server + '-yadcf_delim-' + max_server, column_number); } if (min instanceof Date) { $("#" + fromId).addClass("inuse"); } else { $("#" + fromId).removeClass("inuse"); } if (max instanceof Date) { $("#" + toId).addClass("inuse"); } else { $("#" + toId).removeClass("inuse"); } if ($.trim(event.target.value) === "" && $(event.target).hasClass("inuse")) { $("#" + event.target.id).removeClass("inuse"); } } resetIApiIndex(); }; if (options.filter_delay === undefined) { keyUp(table_selector_jq_friendly, event); } else { yadcfDelay(function () { keyUp(table_selector_jq_friendly, event); }, options.filter_delay); } } function rangeNumberKeyUP(table_selector_jq_friendly, event) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], min, max, fromId, toId, yadcfState, column_number, options, keyUp; column_number = parseInt($(event.target).attr("id").replace('-from-', '').replace('-to-', '').replace('yadcf-filter-' + table_selector_jq_friendly, ''), 10); options = getOptions(oTable.selector)[column_number]; keyUp = function () { if (event.target.id.indexOf("-from-") !== -1) { fromId = event.target.id; toId = event.target.id.replace("-from-", "-to-"); min = document.getElementById(fromId).value; max = document.getElementById(toId).value; } else { toId = event.target.id; fromId = event.target.id.replace("-to-", "-from-"); max = document.getElementById(toId).value; min = document.getElementById(fromId).value; } min = (min !== "") ? (+min) : min; max = (max !== "") ? (+max) : max; if ((!isNaN(max) && !isNaN(min) && (max >= min)) || min === "" || max === "") { if (oTable.fnSettings().oFeatures.bServerSide !== true) { oTable.fnDraw(); } else { oTable.fnFilter(min + '-yadcf_delim-' + max, column_number); } if (document.getElementById(fromId).value !== "") { $("#" + fromId).addClass("inuse"); } if (document.getElementById(toId).value !== "") { $("#" + toId).addClass("inuse"); } if ($.trim(event.target.value) === "" && $(event.target).hasClass("inuse")) { $("#" + event.target.id).removeClass("inuse"); } if (!oTable.fnSettings().oLoadedState) { oTable.fnSettings().oLoadedState = {}; oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } if (oTable.fnSettings().oFeatures.bStateSave === true) { if (oTable.fnSettings().oLoadedState.yadcfState !== undefined && oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly] !== undefined) { oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] = { 'from' : min, 'to' : max }; } else { yadcfState = {}; yadcfState[table_selector_jq_friendly] = []; yadcfState[table_selector_jq_friendly][column_number] = { 'from' : min, 'to' : max }; oTable.fnSettings().oLoadedState.yadcfState = yadcfState; } oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); } } resetIApiIndex(); }; if (options.filter_delay === undefined) { keyUp(); } else { yadcfDelay(function () { keyUp(); }, options.filter_delay); } } function textKeyUP(table_selector_jq_friendly, event, clear) { var column_number = parseInt($(event.target).attr("id").replace("yadcf-filter-" + table_selector_jq_friendly + "-", "").replace('-reset', ''), 10), oTable = oTables[table_selector_jq_friendly], options = getOptions(oTable.selector)[column_number], keyUp = function (table_selector_jq_friendly, event, clear) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; if (clear !== undefined || event.target.value === '') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("").focus(); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse"); oTable.fnFilter("", column_number); resetIApiIndex(); return; } $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse"); yadcfMatchFilter(oTable, event.target.value, options.filter_match_mode, column_number); resetIApiIndex(); }; if (options.filter_delay === undefined) { keyUp(table_selector_jq_friendly, event, clear); } else { yadcfDelay(function () { keyUp(table_selector_jq_friendly, event, clear); }, options.filter_delay); } } function autocompleteKeyUP(table_selector_jq_friendly, event) { if (event.target.value === "" && event.keyCode === 8 && $(event.target).hasClass("inuse")) { $.fn.dataTableExt.iApiIndex = oTablesIndex[table_selector_jq_friendly]; var oTable = oTables[table_selector_jq_friendly], column_number = parseInt($(event.target).attr("id").replace("yadcf-filter-" + table_selector_jq_friendly + "-", ""), 10); $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse"); $(document).removeData("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val"); oTable.fnFilter("", column_number); resetIApiIndex(); } } //taken and modified from DataTables 1.10.0-beta.2 source function yadcfVersionCheck(version) { var aThis = $.fn.dataTable.ext.sVersion.split('.'), aThat = version.split('.'), iThis, iThat, i, iLen; for (i = 0, iLen = aThat.length; i < iLen; i++) { iThis = parseInt(aThis[i], 10) || 0; iThat = parseInt(aThat[i], 10) || 0; // Parts are the same, keep comparing if (iThis === iThat) { continue; } // Parts are different, return immediately return iThis > iThat; } return true; } function initAndBindTable(oTable, table_selector, index) { var table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(table_selector), table_selector_tmp; oTables[table_selector_jq_friendly] = oTable; oTablesIndex[table_selector_jq_friendly] = index; if (oTable.fnSettings().sAjaxSource === null && oTable.fnSettings().ajax === null) { table_selector_tmp = table_selector; if (table_selector.indexOf(":eq") !== -1) { table_selector_tmp = table_selector.substring(0, table_selector.lastIndexOf(":eq")); } appendFilters(oTable, yadcf.getOptions(table_selector_tmp), table_selector); } else { appendFilters(oTable, yadcf.getOptions(table_selector), table_selector); if (yadcfVersionCheck('1.10')) { $(document).off('draw.dt').on('draw.dt', oTable.selector, function (event, ui) { appendFilters(oTable, yadcf.getOptions(ui.oInstance.selector), ui.oInstance.selector); }); $(document).off('xhr.dt').on('xhr.dt', function (e, settings, json) { var col_num; for (col_num in yadcf.getOptions(settings.oInstance.selector)) { if (yadcf.getOptions(settings.oInstance.selector).hasOwnProperty(col_num)) { if (json['yadcf_data_' + col_num] !== undefined) { yadcf.getOptions(settings.oInstance.selector)[col_num].data = json['yadcf_data_' + col_num]; } } } }); $(document).off('column-visibility.dt').on('column-visibility.dt', function (e, settings, col_num, state) { var obj = {}; if (state === true) { obj[col_num] = yadcf.getOptions(settings.oInstance.selector)[col_num]; appendFilters(oTables[yadcf.generateTableSelectorJQFriendly(settings.oInstance.selector)], obj, settings.oInstance.selector); } }); } else { $(document).off('draw').on('draw', oTable.selector, function (event, ui) { appendFilters(oTable, yadcf.getOptions(ui.oInstance.selector), ui.oInstance.selector); }); } } if (oTable.fnSettings().oFeatures.bStateSave === true) { if (yadcfVersionCheck('1.10')) { $(oTable.selector).off('stateSaveParams.dt').on('stateSaveParams.dt', function (e, settings, data) { if (settings.oLoadedState && settings.oLoadedState.yadcfState !== undefined) { data.yadcfState = settings.oLoadedState.yadcfState; } else { data.naruto = 'kurama'; } }); } else { $(oTable.selector).off('stateSaveParams').on('stateSaveParams', function (e, settings, data) { if (settings.oLoadedState && settings.oLoadedState.yadcfState !== undefined) { data.yadcfState = settings.oLoadedState.yadcfState; } else { data.naruto = 'kurama'; } }); } //when using DOM source if (oTable.fnSettings().sAjaxSource === null && oTable.fnSettings().ajax === null) { //we need to make sure that the yadcf state will be saved after page reload oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings()); //redraw the table in order to apply the filters oTable.fnDraw(); } } } $.fn.yadcf = function (options_arg) { if ($(this.selector).length === 1) { setOptions(this.selector, options_arg); initAndBindTable(this, this.selector, 0); } else { var i = 0, selector; for (i; i < $(this.selector).length; i++) { $.fn.dataTableExt.iApiIndex = i; selector = this.selector + ":eq(" + i + ")"; setOptions(this.selector, options_arg); initAndBindTable(this, selector, i); } $.fn.dataTableExt.iApiIndex = 0; } return this; }; function init(oTable, options_arg) { var instance = oTable.settings()[0].oInstance, i = 0, selector; if ($(instance.selector).length === 1) { setOptions(instance.selector, options_arg); initAndBindTable(instance, instance.selector, 0); } else { for (i; i < $(instance.selector).length; i++) { $.fn.dataTableExt.iApiIndex = i; selector = instance.selector + ":eq(" + i + ")"; setOptions(instance.selector, options_arg); initAndBindTable(instance, selector, i); } $.fn.dataTableExt.iApiIndex = 0; } } function stopPropagation(evt) { if (evt.stopPropagation !== undefined) { evt.stopPropagation(); } else { evt.cancelBubble = true; } } //-------------------------------------------------------- function exInternalFilterColumnAJAXQueue(table_arg, col_filter_arr) { return function () { exFilterColumn(table_arg, col_filter_arr, true); }; } function exFilterColumn(table_arg, col_filter_arr, ajaxSource) { var table_selector_jq_friendly, j, tmpStr, column_number, filter_value, fromId, toId, sliderId, optionsObj; //check if the table arg is from new datatables API (capital "D") if (table_arg.settings !== undefined) { table_arg = table_arg.settings()[0].oInstance; } table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(table_arg.selector); if ((table_arg.fnSettings().sAjaxSource === null && table_arg.fnSettings().ajax === null) || ajaxSource === true) { for (j = 0; j < col_filter_arr.length; j++) { column_number = col_filter_arr[j][0]; optionsObj = getOptions(table_arg.selector)[column_number]; filter_value = col_filter_arr[j][1]; switch (optionsObj.filter_type) { case 'select': case 'auto_complete': case 'text': case 'date': $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(filter_value).addClass('inuse'); tmpStr = yadcfMatchFilterString(table_arg, column_number, filter_value, optionsObj.filter_match_mode, false); table_arg.fnSettings().aoPreSearchCols[column_number].sSearch = tmpStr; break; case 'multi_select': $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(filter_value); tmpStr = yadcfMatchFilterString(table_arg, column_number, filter_value, optionsObj.filter_match_mode, true); table_arg.fnSettings().aoPreSearchCols[column_number].sSearch = tmpStr; if (optionsObj.select_type !== undefined) { if (optionsObj.select_type === 'chosen') { $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).trigger('chosen:updated'); } else if (optionsObj.select_type === 'select2') { $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).select2("destroy").select2(optionsObj.select_type_options); } } break; case 'range_date': fromId = 'yadcf-filter-' + table_selector_jq_friendly + '-from-date-' + column_number; toId = 'yadcf-filter-' + table_selector_jq_friendly + '-to-date-' + column_number; if (filter_value.from !== '') { $('#' + fromId).val(filter_value.from); $('#' + fromId).addClass('inuse'); } if (filter_value.to !== '') { $('#' + toId).val(filter_value.to); $('#' + toId).addClass('inuse'); } break; case 'range_number': fromId = 'yadcf-filter-' + table_selector_jq_friendly + '-from-' + column_number; toId = 'yadcf-filter-' + table_selector_jq_friendly + '-to-' + column_number; if (filter_value.from !== '') { $('#' + fromId).val(filter_value.from); $('#' + fromId).addClass('inuse'); } if (filter_value.to !== '') { $('#' + toId).val(filter_value.to); $('#' + toId).addClass('inuse'); } break; case 'range_number_slider': sliderId = 'yadcf-filter-' + table_selector_jq_friendly + '-slider-' + column_number; fromId = 'yadcf-filter-' + table_selector_jq_friendly + '-min_tip-' + column_number; toId = 'yadcf-filter-' + table_selector_jq_friendly + '-max_tip-' + column_number; if (filter_value.from !== '') { $('#' + fromId).text(filter_value.from); $('#' + fromId).parent().addClass('inuse'); $('#' + fromId).parent().parent().find('ui-slider-range').addClass('inuse'); $('#' + sliderId).slider('values', 0, filter_value.from); } if (filter_value.to !== '') { $('#' + toId).text(filter_value.to); $('#' + toId).parent().addClass('inuse'); $('#' + toId).parent().parent().find('.ui-slider-range').addClass('inuse'); $('#' + sliderId).slider('values', 1, filter_value.to); } break; } } if (table_arg.fnSettings().oFeatures.bServerSide !== true) { table_arg.fnDraw(); } else { switch (optionsObj.filter_type) { case 'select': case 'auto_complete': case 'text': case 'date': setTimeout(function () { table_arg.fnFilter(filter_value, column_number); }, 10); break; default: console.log('exFilterColumn is not supported for ' + optionsObj.filter_type); break; } } } else { exFilterColumnQueue.push(exInternalFilterColumnAJAXQueue(table_arg, col_filter_arr)); } } function exGetColumnFilterVal(table_arg, column_number) { var retVal, fromId, toId, table_selector_jq_friendly, optionsObj = getOptions(table_arg.selector)[column_number]; table_selector_jq_friendly = yadcf.generateTableSelectorJQFriendly(table_arg.selector); switch (optionsObj.filter_type) { case 'select': retVal = $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(); if (retVal === '-1') { retVal = ''; } break; case 'auto_complete': case 'text': case 'date': retVal = $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(); break; case 'multi_select': retVal = $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(); if (retVal === null) { retVal = ''; } break; case 'range_date': retVal = {}; fromId = 'yadcf-filter-' + table_selector_jq_friendly + '-from-date-' + column_number; toId = 'yadcf-filter-' + table_selector_jq_friendly + '-to-date-' + column_number; retVal.from = $('#' + fromId).val(); retVal.to = $('#' + toId).val(); break; case 'range_number': retVal = {}; fromId = 'yadcf-filter-' + table_selector_jq_friendly + '-from-' + column_number; toId = 'yadcf-filter-' + table_selector_jq_friendly + '-to-' + column_number; retVal.from = $('#' + fromId).val(); retVal.to = $('#' + toId).val(); break; case 'range_number_slider': retVal = {}; fromId = 'yadcf-filter-' + table_selector_jq_friendly + '-min_tip-' + column_number; toId = 'yadcf-filter-' + table_selector_jq_friendly + '-max_tip-' + column_number; retVal.from = $('#' + fromId).text(); retVal.to = $('#' + toId).text(); break; } return retVal; } return { init : init, doFilter : doFilter, doFilterMultiSelect : doFilterMultiSelect, doFilterAutocomplete : doFilterAutocomplete, autocompleteKeyUP : autocompleteKeyUP, getOptions : getOptions, rangeNumberKeyUP : rangeNumberKeyUP, rangeDateKeyUP : rangeDateKeyUP, rangeClear : rangeClear, rangeNumberSliderClear : rangeNumberSliderClear, stopPropagation : stopPropagation, generateTableSelectorJQFriendly : generateTableSelectorJQFriendly, exFilterColumn : exFilterColumn, exGetColumnFilterVal : exGetColumnFilterVal, dateKeyUP : dateKeyUP, dateSelectSingle : dateSelectSingle, textKeyUP : textKeyUP, doFilterCustomDateFunc : doFilterCustomDateFunc }; }(jQuery)); /*! TableTools 2.2.3 2009-2014 SpryMedia Ltd - datatables.net/license ZeroClipboard 1.0.4 Author: Joseph Huckaby - MIT licensed */ var TableTools; (function(n,k,q){var p=function(m,p){var g={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=k.getElementById(a));a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+a+ "\\s*"))});return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};""!==a.style.width&&(b.width=a.style.width.replace("px",""));""!==a.style.height&&(b.height=a.style.height.replace("px",""));for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b}, Client:function(a){this.handlers={};this.id=g.nextId++;this.movieId="ZeroClipboard_TableToolsMovie_"+this.id;g.register(this.id,this);a&&this.glue(a)}};g.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=g.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex,10)+1);var d=g.getDOMObjectPosition(this.domElement);this.div=k.createElement("div");var f= this.div.style;f.position="absolute";f.left="0px";f.top="0px";f.width=d.width+"px";f.height=d.height+"px";f.zIndex=c;"undefined"!=typeof b&&""!==b&&(this.div.title=b);0!==d.width&&0!==d.height&&(this.sized=!0);this.domElement&&(this.domElement.appendChild(this.div),this.div.innerHTML=this.getHTML(d.width,d.height).replace(/&/g,"&"))},positionElement:function(){var a=g.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.width=a.width+"px";b.height=a.height+"px";0!==a.width&& 0!==a.height&&(this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height=a.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var f=location.href.match(/^https/i)?"https://":"http://",c=c+('');else c+='';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=k.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){a&&((this.domElement=g.$(a))||this.hide());if(this.domElement&&this.div){var a=g.getDOMObjectPosition(this.domElement),b=this.div.style;b.left=""+a.left+ "px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)},setAction:function(a){this.action= a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){var c,a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=k.getElementById(this.movieId);if(!this.movie){c=this;setTimeout(function(){c.receiveEvent("load", null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled);break;case "mouseover":this.domElement&&this.cssEffects&& this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0));break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var d=0,f=this.handlers[a].length;d< f;d++){var e=this.handlers[a][d];if("function"==typeof e)e(this,b);else if("object"==typeof e&&2==e.length)e[0][e[1]](this,b);else if("string"==typeof e)n[e](this,b)}}};n.ZeroClipboard_TableTools=g;var e=jQuery;TableTools=function(a,b){!this instanceof TableTools&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:e.fn.dataTable.Api?(new e.fn.dataTable.Api(a)).settings()[0]:a.fnSettings(),print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}}, buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1,tags:{}};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null,background:null}};this.classes=e.extend(!0,{},TableTools.classes);this.s.dt.bJUI&&e.extend(!0,this.classes,TableTools.classes_themeroller);this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});TableTools._aInstances.push(this); this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(a){var b=[],c=this.s.dt.aoData,d=this.s.dt.aiDisplay,f;if(a){a=0;for(f=d.length;a"¡".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns,a=this._fnColumnTargets(a.mColumns),c=[],d=0,f=0,e,i;e=0;for(i=a.length;e").addClass(this.classes.print.info).html(a).appendTo("body");setTimeout(function(){c.fadeOut("normal",function(){c.remove()})},b)},fnContainer:function(){return this.dom.container},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);this.dom.container=k.createElement(this.s.tags.container);this.dom.container.className=this.classes.container; "none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){e(b.s.dt.nTBody).off("click.DTTT_Select","tr");e(b.dom.container).empty();var a=e.inArray(b,TableTools._aInstances);-1!==a&&TableTools._aInstances.splice(a,1)}})},_fnCustomiseSettings:function(a){"undefined"==typeof this.s.dt._TableToolsInit&&(this.s.master=!0,this.s.dt._TableToolsInit=!0);this.dom.table=this.s.dt.nTable; this.s.custom=e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;"undefined"!=typeof g&&(g.moviePath=this.s.swfPath);this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected;this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.custom.sSelectedClass&&(this.classes.select.row=this.s.custom.sSelectedClass);this.s.tags=this.s.custom.oTags;this.s.buttonSet=this.s.custom.aButtons}, _fnButtonDefinations:function(a,b){for(var c,d=0,f=a.length;dh?i:h)+"px";l.style.width=(o>g?o:g)+"px";l.className=this.classes.collection.background;e(l).css("opacity",0);k.body.appendChild(l);k.body.appendChild(f);i=e(f).outerWidth();o=e(f).outerHeight();j+i>g&&(f.style.left=g-i+"px");d+o>h&&(f.style.top=d-o-e(a).outerHeight()+"px");this.dom.collection.collection=f;this.dom.collection.background=l;setTimeout(function(){e(f).animate({opacity:1},500);e(l).animate({opacity:0.25},500)},10);this.fnResizeButtons();e(l).click(function(){c._fnCollectionHide.call(c, null,null)})},_fnCollectionHide:function(a,b){!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection&&(e(this.dom.collection.collection).animate({opacity:0},500,function(){this.style.display="none"}),e(this.dom.collection.background).animate({opacity:0},500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null)},_fnRowSelectConfig:function(){if(this.s.master){var a=this,b=this.s.dt;e(b.nTable).addClass(this.classes.select.table); "os"===this.s.select.type&&(e(b.nTBody).on("mousedown.DTTT_Select","tr",function(a){if(a.shiftKey)e(b.nTBody).css("-moz-user-select","none").one("selectstart.DTTT_Select","tr",function(){return!1})}),e(b.nTBody).on("mouseup.DTTT_Select","tr",function(){e(b.nTBody).css("-moz-user-select","")}));e(b.nTBody).on("click.DTTT_Select",this.s.custom.sRowSelector,function(c){var d=this.nodeName.toLowerCase()==="tr"?this:e(this).parents("tr")[0],f=a.s.select,j=a.s.dt.oInstance.fnGetPosition(d);if(d.parentNode== b.nTBody&&b.oInstance.fnGetData(d)!==null){if(f.type=="os")if(c.ctrlKey||c.metaKey)a.fnIsSelected(d)?a._fnRowDeselect(d,c):a._fnRowSelect(d,c);else if(c.shiftKey){var i=a.s.dt.aiDisplay.slice(),h=e.inArray(f.lastRow,i),o=e.inArray(j,i);if(a.fnGetSelected().length===0||h===-1)i.splice(e.inArray(j,i)+1,i.length);else{if(h>o)var g=o,o=h,h=g;i.splice(o+1,i.length);i.splice(0,h)}if(a.fnIsSelected(d)){i.splice(e.inArray(j,i),1);a._fnRowDeselect(i,c)}else a._fnRowSelect(i,c)}else if(a.fnIsSelected(d)&&a.fnGetSelected().length=== 1)a._fnRowDeselect(d,c);else{a.fnSelectNone();a._fnRowSelect(d,c)}else if(a.fnIsSelected(d))a._fnRowDeselect(d,c);else if(f.type=="single"){a.fnSelectNone();a._fnRowSelect(d,c)}else f.type=="multi"&&a._fnRowSelect(d,c);f.lastRow=j}});b.oApi._fnCallbackReg(b,"aoRowCreatedCallback",function(c,d,f){b.aoData[f]._DTTT_selected&&e(c).addClass(a.classes.select.row)},"TableTools-SelectAll")}},_fnRowSelect:function(a,b){var c=this._fnSelectData(a),d=[],f,j;f=0;for(j=c.length;f/g,"").replace(/^\s+|\s+$/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));i.push(j.join(a.sFieldSeperator))}d= !0;var m;f=this.fnGetSelectedIndexes();m=(d="none"!==this.s.select.type&&d&&0!==f.length)?f:p.Api?(new p.Api(g)).rows(a.oSelectorOpts).indexes().flatten().toArray():g.oInstance.$("tr",a.oSelectorOpts).map(function(a,b){return g.oInstance.fnGetPosition(b)}).get();d=0;for(f=m.length;d]+)).*?>/gi, "$1$2$3"),h=h.replace(/<.*?>/g,"")):h+="",h=h.replace(/^\s+/,"").replace(/\s+$/,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));i.push(j.join(a.sFieldSeperator));a.bOpenRows&&(b=e.grep(g.aoOpenRows,function(a){return a.nParent===k}),1===b.length&&(h=this._fnBoundData(e("td",b[0].nTr).html(),a.sFieldBoundary,l),i.push(h)))}if(a.bFooter&&null!==g.nTFoot){j=[];b=0;for(c=g.aoColumns.length;b/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));i.push(j.join(a.sFieldSeperator))}return i.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,f=0;f").addClass(this.classes.print.message).html(a.sMessage).prependTo("body");this.s.print.saveScroll=e(n).scrollTop();n.scrollTo(0,0);e(k).bind("keydown.DTTT",function(a){if(a.keyCode== 27){a.preventDefault();b._fnPrintEnd.call(b,a)}})},_fnPrintEnd:function(){var a=this.s.dt,b=this.s.print;this._fnPrintShowNodes();if(""!==a.oScroll.sX||""!==a.oScroll.sY)e(this.s.dt.nTable).unbind("draw.DTTT_Print"),this._fnPrintScrollEnd();n.scrollTo(0,b.saveScroll);e("div."+this.classes.print.message).remove();e(k.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;a.oApi._fnCalculateEnd&&a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(k).unbind("keydown.DTTT")}, _fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");var b=a.nTable.parentNode,c;c=a.nTable.getElementsByTagName("thead");0Table copied

Copied "+a+" row"+(1==a?"":"s")+" to the clipboard.

",1500)}}),pdf:e.extend({},TableTools.buttonBase,{sAction:"flash_pdf",sNewLine:"\n",sFileName:"*.pdf",sButtonClass:"DTTT_button_pdf", sButtonText:"PDF",sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))}}),print:e.extend({},TableTools.buttonBase,{sInfo:"
Print view

Please use your browser's print function to print this table. Press escape when finished.

",sMessage:null,bShowAll:!0, sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonText:"Print",fnClick:function(a,b){this.fnPrint(!0,b)}}),text:e.extend({},TableTools.buttonBase),select:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_single:e.extend({},TableTools.buttonBase,{sButtonText:"Select button", fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_all:e.extend({},TableTools.buttonBase,{sButtonText:"Select all",fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==this.s.dt.fnRecordsDisplay()?e(a).addClass(this.classes.buttons.disabled):e(a).removeClass(this.classes.buttons.disabled)}}),select_none:e.extend({}, TableTools.buttonBase,{sButtonText:"Deselect all",fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),ajax:e.extend({},TableTools.buttonBase,{sAjaxUrl:"/xhr.php",sButtonText:"Ajax button",fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete, dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnAjaxComplete:function(){alert("Ajax complete")}}),div:e.extend({},TableTools.buttonBase,{sAction:"div",sTag:"div",sButtonClass:"DTTT_nonbutton",sButtonText:"Text button"}),collection:e.extend({},TableTools.buttonBase,{sAction:"collection",sButtonClass:"DTTT_button_collection",sButtonText:"Collection",fnClick:function(a,b){this._fnCollectionShow(a,b)}})};TableTools.buttons=TableTools.BUTTONS; TableTools.classes={container:"DTTT_container",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"},collection:{container:"DTTT_collection",background:"DTTT_collection_background",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"}},select:{table:"DTTT_selectable",row:"DTTT_selected selected"},print:{body:"DTTT_Print",info:"DTTT_print_info",message:"DTTT_PrintMessage"}};TableTools.classes_themeroller={container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"}, collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}};TableTools.DEFAULTS={sSwfPath:"../swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sRowSelector:"tr",sSelectedClass:null,fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"],oTags:{container:"div",button:"a",liner:"span",collection:{container:"div",button:"a",liner:"span"}}};TableTools.defaults=TableTools.DEFAULTS;TableTools.prototype.CLASS="TableTools";TableTools.version="2.2.3"; e.fn.dataTable.Api&&e.fn.dataTable.Api.register("tabletools()",function(){var a=null;0<'col-xs-6'f>r>"+ "t"+ "<'row'<'col-xs-6'i><'col-xs-6'p>>", renderer: 'bootstrap' } ); /* Default class modification */ $.extend( DataTable.ext.classes, { sWrapper: "dataTables_wrapper form-inline dt-bootstrap", sFilterInput: "form-control input-sm", sLengthSelect: "form-control input-sm" } ); /* 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; 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 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 = $('
  • ', { 'class': classes.sPageButton+' '+btnClass, 'aria-controls': settings.sTableId, 'tabindex': settings.iTabIndex, 'id': idx === 0 && typeof button === 'string' ? settings.sTableId +'_'+ button : null } ) .append( $('', { 'href': '#' } ) .html( btnDisplay ) ) .appendTo( container ); settings.oApi._fnBindAction( node, {action: button}, clickHandler ); } } } }; attach( $(host).empty().html('
      ').children('ul'), buttons ); }; /* * TableTools Bootstrap compatibility * Required TableTools 2.1+ */ if ( DataTable.TableTools ) { // Set the classes that TableTools uses to something suitable for Bootstrap $.extend( true, DataTable.TableTools.classes, { "container": "DTTT btn-group", "buttons": { "normal": "btn btn-default", "disabled": "disabled" }, "collection": { "container": "DTTT_dropdown dropdown-menu", "buttons": { "normal": "", "disabled": "disabled" } }, "print": { "info": "DTTT_print_info modal" }, "select": { "row": "active" } } ); // Have the collection use a bootstrap compatible drop down $.extend( true, DataTable.TableTools.DEFAULTS.oTags, { "collection": { "container": "ul", "button": "li", "liner": "a" } } ); } }; // /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);