/* * File: jquery.dataTables.columnFilter.js * Version: 1.5.0. * Author: Jovan Popovic * http://jquery-datatables-column-filter.googlecode.com/svn/trunk/index.htmls * http://code.google.com/p/jquery-datatables-column-filter/ * * Copyright 2011-2012 Jovan Popovic, all rights reserved. * * This source file is free software, under either the GPL v2 license or a * BSD style license, as supplied with this software. * * 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. * * Parameters:" * @sPlaceHolder String Place where inline filtering function should be placed ("tfoot", "thead:before", "thead:after"). Default is "tfoot" * @sRangeSeparator String Separator that will be used when range values are sent to the server-side. Default value is "~". * @sRangeFormat string Default format of the From ... to ... range inputs. Default is From {from} to {to} * @aoColumns Array Array of the filter settings that will be applied on the columns */(function(e){e.fn.columnFilter=function(t){function c(e,t,n,r,i){if(typeof t=="undefined")return new Array;typeof n=="undefined"&&(n=!0);typeof r=="undefined"&&(r=!0);typeof i=="undefined"&&(i=!0);var s;r==1?s=e.aiDisplay:s=e.aiDisplayMaster;var o=new Array;for(var u=0,a=s.length;u-1)continue;o.push(c)}return o.sort()}function h(e){return S.bUseColVis?e:w.fnSettings().oApi._fnVisibleToColumnIndex(w.fnSettings(),e)}function p(t,o,u,a,f,c){var p="text_filter";a&&(p="number_filter");i=i.replace(/(^\s*)|(\s*$)/g,"");var d=t.fnSettings().aoPreSearchCols[r].sSearch,v="search_init ",m=i;if(d!=""&&d!="^"){a&&d.charAt(0)=="^"?m=d.substr(1):m=d;v=""}var g=e('');c!=undefined&&c!=-1&&g.attr("maxlength",c);s.html(g);a?s.wrapInner(''):s.wrapInner('');n[r]=i;var y=r;a&&!t.fnSettings().oFeatures.bServerSide?g.keyup(function(){t.fnFilter("^"+this.value,h(y),!0,!1);l()}):g.keyup(function(){if(t.fnSettings().oFeatures.bServerSide&&f!=0){var n=t.fnSettings().aoPreSearchCols[y].sSearch,r=e(this).data("dt-iLastFilterLength");typeof r=="undefined"&&(r=0);var i=this.value.length;if(Math.abs(i-r)');s.append(i);s.append(b(1));var o=t.attr("id")+"_range_to_"+r,u=e('');s.append(u);s.append(b(2));s.wrapInner('');var f=r;a.push(r);t.dataTableExt.afnFiltering.push(function(e,r,i){if(t.attr("id")!=e.sTableId)return!0;if(document.getElementById(n)==null)return!0;var s=document.getElementById(n).value*1,u=document.getElementById(o).value*1,a=r[h(f)]=="-"?0:r[h(f)]*1;return s==""&&u==""?!0:s==""&&a<=u?!0:s<=a&&""==u?!0:s<=a&&a<=u?!0:!1});e("#"+n+",#"+o,s).keyup(function(){var e=document.getElementById(n).value*1,r=document.getElementById(o).value*1;if(e!=0&&r!=0&&e>r)return;t.fnDraw();l()})}function v(t){var n=o.split(/[}{]/);s.html("");var i=t.attr("id")+"_range_from_"+r,u=e('');u.datepicker();var f=t.attr("id")+"_range_to_"+r,c=e('');for(ti=0;ti');c.datepicker();var p=r;a.push(r);t.dataTableExt.afnFiltering.push(function(n,r,i){if(t.attr("id")!=n.sTableId)return!0;var s=u.datepicker("getDate"),o=c.datepicker("getDate");if(s==null&&o==null)return!0;var a=null;try{if(r[h(p)]==null||r[h(p)]=="")return!1;a=e.datepicker.parseDate(e.datepicker.regional[""].dateFormat,r[h(p)])}catch(f){return!1}return a==null?!1:s==null&&a<=o?!0:s<=a&&o==null?!0:s<=a&&a<=o?!0:!1});e("#"+i+",#"+f,s).change(function(){t.fnDraw();l()})}function m(t,n,i,s,o,u,a){n==null&&(n=c(t.fnSettings(),i,!0,!1,!0));var f=i,h=t.fnSettings().aoPreSearchCols[r].sSearch;if(h==null||h=="")h=a;var p='");s.html(g);s.wrapInner('');g.change(function(){e(this).val()!=""?e(this).removeClass("search_init"):e(this).addClass("search_init");u?t.fnFilter(e(this).val(),i,u):t.fnFilter(unescape(e(this).val()),i);l()});h!=null&&h!=""&&t.fnFilter(unescape(h),i)}function g(e,t,n,o){var u=e.fnSettings();t==null&&u.sAjaxSource!=""&&!u.oFeatures.bServerSide&&u.aoDrawCallback.push({fn:function(t,r,i){return function(){if(u.iDraw==2&&u.sAjaxSource!=null&&u.sAjaxSource!=""&&!u.oFeatures.bServerSide)return m(e,null,h(t),r,i,n,o)}}(r,s,i),sName:"column_filter_"+r});m(e,t,h(r),s,i,n,o)}function y(t,n){n==null&&(n=c(t.fnSettings(),r,!0,!0,!0));var o=r,u="",a,f=n.length,h=i.replace("%","Perc").replace("&","AND").replace("$","DOL").replace("£","STERL").replace("@","AT").replace(/\s/g,"_");h=h.replace(/[^a-zA-Z 0-9]+/g,"");var p=i;if(S.sFilterButtonText!=null||S.sFilterButtonText!=undefined)p=S.sFilterButtonText;var d=10,v=12,m=Math.floor(f/v);f%v>0&&(m+=1);var g=100/m-2,y=d*m;m==1&&(g=20);var b='
',w="
",E=t.attr("id")+h,x="chkBtnOpen"+E,T=E+"-flt-toggle";u+='";u+='
';u+=b;for(a=0;a'+n[a]+"
";var N=e(u);s.html(N);s.wrapInner('');N.change(function(){var r="",i="|",s=e('input:checkbox[name="'+h+'"]:checked').size();e('input:checkbox[name="'+h+'"]:checked').each(function(t){if(t==0&&s==1||t!=0&&t==s-1)i="";r=r.replace(/^\s+|\s+$/g,"");r=r+e(this).val()+i;i="|"});for(var u=0;u