Changeset 31740

Show
Ignore:
Timestamp:
15.06.2017 13:59:32 (2 years ago)
Author:
kjdon
Message:

need to make firstNumber and secondNumber actual number variables, not string variables. otherwise eg 2 is not less than 10

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r31531 r31740  
    811811      var currentValue = values[l].replace(/^ +/g, "").replace(/ +$/g, ""); 
    812812      if (numeric_match) { 
    813     var isRange = (currentValue.search(/\d+-\d+/) != -1); 
     813    var isRange = (currentValue.search(/^\d+-\d+$/) != -1); 
    814814    if (isRange) { 
    815       var firstNumber = currentValue.replace(/(\d+)-\d+/, "$1"); 
    816       var secondNumber = currentValue.replace(/\d+-(\d+)/, "$1"); 
    817        
     815        var firstNumber = Number(currentValue.replace(/(\d+)-\d+/, "$1")); 
     816        var secondNumber = Number(currentValue.replace(/\d+-(\d+)/, "$1")); 
    818817      if(firstNumber <= secondNumber) 
    819818        { 
     
    822821          var numString = i + ""; 
    823822          for(var j = 0; j < _titles.length; j++) { 
    824              
    825823            var currentTitle = _titles[j]; 
    826824            if(currentTitle[index] == numString) { 
    827               matchingTitles.push(currentTitle); 
     825            matchingTitles.push(currentTitle); 
     826            break; // assume no titles are the same 
    828827            } 
    829828          } 
     
    835834        if (_titles[j][index]==currentValue) { 
    836835          matchingTitles.push(_titles[j]); 
     836        break; // assume no titles are the same 
    837837        } 
    838838      } 
     
    864864      $(matchingTitles[i][1].cell).css("display", "table-cell"); 
    865865    } 
    866     } 
     866    } // end doFiltering() function 
    867867 
    868868    var setUpFilterBox = function()