Slickgrid过滤器无法在IE中运行

时间:2011-12-28 16:31:31

标签: javascript slickgrid

我刚刚在www.werelate.org/wiki/Special:ListPages/Jdfoote1完成了我的第一个SlickGrid实现。

不幸的是,我一直在收到报告,说过滤器不适用于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;
} 

非常感谢!

1 个答案:

答案 0 :(得分:0)

所以,我了解到问题是我的循环问题。我猜IE需要格式为

的循环
for (variable=startvalue;variable<=endvalue;variable=variable+increment)

所以,我的

for (j in searchWords)

打破了东西,因为你不能像这样循环一个数组。哎呀。 :)