ng-grid filterOptions空白filterText在IE8中不起作用

时间:2013-10-10 20:54:58

标签: angularjs ng-grid

当我设置filterOptions.filterText = 'category : ' + filteringText时,filteringText为空时我看不到任何行。但是,如果filteringText不为空,则此过滤器有效。

以下是plnkr

中的预览

这只是IE8的问题。有什么方法可以解决这个问题吗?

要复制此问题,请将其下载为zip文件并在IE8中运行。复选框'All'应显示所有行,隐藏所有行。 (我上面给出的预览链接,在IE8中不起作用,所以你必须下载plunk并打开index.html文件。感谢IE8)

1 个答案:

答案 0 :(得分:0)

看起来ie8将 undefined 传递给ng-model以获取空字符串。

因为你的ngmodel指令绑定了filteringText

<input type="radio" ng-model="filteringText" value="" /> All

然后你看这个实际上设置了filterText,尝试将你的代码更改为

$scope.$watch('filteringText',function(newVal){
    if ((newVal === '') || (typeof newVal == 'undefined')) {
        $scope.gridOptions.filterOptions.filterText = '';
    }
    else
      $scope.gridOptions.filterOptions.filterText = 'category : ' + newVal;
});

我进行了简单的测试,似乎在IE8和chrome v30中都有效。