2011-12-28 42 views
0

我刚刚完成了我的第一个SlickGrid实现,其编号为www.werelate.org/wiki/Special:ListPages/Jdfoote1Slickgrid过滤器不能在IE中工作

不幸的是,我一直在收到报告,说过滤器在IE上不起作用。我想知道在IE上SlickGrid过滤是否存在已知问题。这里是有问题的代码:

// Define search filter (currently searches name, birth place, and death place) 
function myFilter(item) { 
var searchWords = getWords(searchString); 
var searchFields = ["name","birthPlace","deathPlace", "birthDate", "deathDate"]; 
if (searchWords){ 
    // Go through each of the words in the search string 
    for (j in searchWords){ 
     var itemFound = false; 
     searchWord = searchWords[j].toUpperCase(); 
     // Make sure that the word is in at least one of the search fields. 
     for (i in searchFields){ 
      if (item[searchFields[i]].toUpperCase().indexOf(searchWord) != -1){ 
       itemFound = true; 
      } 
     } 
     if (itemFound === false){ 
      return false; 
     } 
    } 
} 
    return true; 
} 

// Get all of the words in a search string 
function getWords(wordString){ 
    pattern = /[^, ]+/g; 
    wordArray = wordString.match(pattern); 
    return wordArray; 
} 

非常感谢!

+0

在Chrome中似乎并没有工作。没有JS错误报告。 – Tin 2011-12-28 20:12:35

+0

对不起 - 这只是代码的一小部分。 – Jeremy 2011-12-29 02:09:55

回答

0

因此,我了解到问题在于我的for循环。我想IE需要循环格式

for (variable=startvalue;variable<=endvalue;variable=variable+increment) 

所以,我

for (j in searchWords) 

分手的事情,因为你无法通过这样的数组循环。哎呀。 :)