【问题标题】:Slickgrid filter not working in IESlickgrid 过滤器在 IE 中不起作用
【发布时间】:2011-12-28 16:31:30
【问题描述】:

我刚刚在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;
} 

非常感谢!

【问题讨论】:

  • 在 Chrome 中似乎根本不起作用。没有 JS 错误被报告。
  • 抱歉,这只是代码的一小部分。

标签: javascript slickgrid


【解决方案1】:

所以,我了解到问题出在我的 for 循环上。我猜 IE 需要格式的循环

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

所以,我的

for (j in searchWords)

因为你不能循环遍历这样的数组,所以破坏了一些东西。哎呀。 :)

【讨论】:

    猜你喜欢
    • 2013-10-16
    • 1970-01-01
    • 2013-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-10
    相关资源
    最近更新 更多