diff --git a/src/tablefilter_all.js b/src/tablefilter_all.js index d370a6aa..98c623b5 100644 --- a/src/tablefilter_all.js +++ b/src/tablefilter_all.js @@ -706,8 +706,8 @@ function TF(id) { loadextensions: 'LoadExtensions', loadthemes: 'LoadThemes' }, - getKeyCode: function(e){ - return e.charCode ? evt.charCode : + getKeyCode: function(evt){ + return evt.charCode ? evt.charCode : (evt.keyCode ? evt.keyCode: (evt.which ? evt.which : 0)); }, /*==================================================== @@ -3282,7 +3282,7 @@ TF.prototype = { - execute filtering (boolean) =====================================================*/ __deferMultipleSelection: function(slc,index,filter){ - if(slc.nodeName.tf_LCase() !== 'select'){ + if(slc.nodeName.tf_LCase()!=='select'){ return; } var doFilter = filter===undefined ? false : filter; @@ -3290,7 +3290,7 @@ TF.prototype = { window.setTimeout(function(){ slc.options[0].selected = false; - if(slc.options[index].value=='') + if(slc.options[index].value==='') slc.options[index].selected = false; else slc.options[index].selected = true; @@ -3298,99 +3298,127 @@ TF.prototype = { }, 0.1); }, - __getCustomValues: function(colIndex) /*==================================================== - Returns an array [[values],[texts]] with custom values for a given filter - Param: column index (integer) =====================================================*/ - { - if(colIndex==undefined) return; - var isCustomSlc = (this.hasCustomSlcOptions //custom select test - && this.customSlcOptions.cols.tf_Has(colIndex)); - if(!isCustomSlc) return; + __getCustomValues: function(colIndex){ + if(!colIndex){ + return; + } + //custom select test + var isCustomSlc = this.hasCustomSlcOptions && + this.customSlcOptions.cols.tf_Has(colIndex); + if(!isCustomSlc){ + return; + } var optTxt = [], optArray = []; var index = this.customSlcOptions.cols.tf_IndexByValue(colIndex); var slcValues = this.customSlcOptions.values[index]; var slcTexts = this.customSlcOptions.texts[index]; var slcSort = this.customSlcOptions.sorts[index]; - for(var r=0; r 0){ - if(o.hasCustomSlcOptions && o.customSlcOptions.cols.tf_Has(colIndex)){ + var tmpVal = tf_CookieValueByIndex( + o.fltsValuesCookie, colIndex, separator); + if(tmpVal && tmpVal.tf_Trim().length > 0){ + if(o.hasCustomSlcOptions && + o.customSlcOptions.cols.tf_Has(colIndex)){ fltArr.push(tmpVal); - } else { fltArr = tmpVal.split(' '+o.orOperator+' '); } + } else { + fltArr = tmpVal.split(' '+o.orOperator+' '); + } } - for(var y=0; y