1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-23 16:52:26 +02:00
TableFilter/dist/TF_Modules/tf_cookies.js
2015-03-06 19:49:30 +11:00

1 line
2.2 KiB
JavaScript

TF.prototype.RememberFiltersValue=function(e){var t=[];for(var n=0;n<this.fltIds.length;n++)value=this.GetFilterValue(n),value==""&&(value=" "),t.push(value);t.push(this.fltIds.length),tf_WriteCookie(e,t.join(this.separator),this.cookieDuration)},TF.prototype.RememberPageNb=function(e){tf_WriteCookie(e,this.currentPageNb,this.cookieDuration)},TF.prototype.RememberPageLength=function(e){tf_WriteCookie(e,this.resultsPerPageSlc.selectedIndex,this.cookieDuration)},TF.prototype.ResetValues=function(){this.EvtManager(this.Evt.name.resetvalues)},TF.prototype._ResetValues=function(){this.rememberGridValues&&this.fillSlcOnDemand&&this.ResetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.ResetPageLength(this.pgLenCookie),this.rememberPageNb&&this.ResetPage(this.pgNbCookie)},TF.prototype.ResetGridValues=function(e){if(!this.fillSlcOnDemand)return;var t=tf_ReadCookie(e),n=new RegExp(this.separator,"g"),r=t.split(n),i=this.GetFiltersByType(this.fltTypeSlc,!0),s=this.GetFiltersByType(this.fltTypeMulti,!0);if(r[r.length-1]==this.fltIds.length){for(var o=0;o<r.length-1;o++){if(r[o]==" ")continue;if(this["col"+o]==this.fltTypeSlc||this["col"+o]==this.fltTypeMulti){var u=tf_Id(this.fltIds[o]);u.options[0].selected=!1;if(i.tf_Has(o)){var a=tf_CreateOpt(r[o],r[o],!0);u.appendChild(a),this.hasStoredValues=!0}if(s.tf_Has(o)){var f=r[o].split(" "+this.orOperator+" ");for(j=0;j<f.length;j++){if(f[j]=="")continue;var a=tf_CreateOpt(f[j],f[j],!0);u.appendChild(a),this.hasStoredValues=!0,tf_isIE&&(this.__deferMultipleSelection(u,j,!1),hasStoredValues=!1)}}}else if(this["col"+o]==this.fltTypeCheckList){var l=this.checkListDiv[o];l.title=l.innerHTML,l.innerHTML="";var c=tf_CreateElm("ul",["id",this.fltIds[o]],["colIndex",o]);c.className=this.checkListCssClass;var h=tf_CreateCheckItem(this.fltIds[o]+"_0","",this.displayAllText);h.className=this.checkListItemCssClass,c.appendChild(h),l.appendChild(c);var f=r[o].split(" "+this.orOperator+" ");for(j=0;j<f.length;j++){if(f[j]=="")continue;var p=tf_CreateCheckItem(this.fltIds[o]+"_"+(j+1),f[j],f[j]);p.className=this.checkListItemCssClass,c.appendChild(p),p.check.checked=!0,this.__setCheckListValues(p.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.SetPagingInfo()}};