0

I have an issue where I have to display one of two ui-grids depending on a selection by the user. The problem is using the 'if' statement causes Angular to run several digest cycles. This is not a problem in Chrome, but in IE 11, it crashes the browser. Is there anyway to tell Angular to run the digest cycle once? Or is there a better way to implement the switch in grids? This is a real problem as most of our users use IE.

Here is the code that is causing the problem:

        if ($scope.form.ReleasedStatus == 3) {
            $scope.generalSearch = false;
        }
        $scope.waitsearch = generalsearchService.submitSearch($scope.form)            
        .success(function (data) {                
            $scope.results = data;
            $scopee.gridOptions.data = data;
            $scope.gridOptions3.data = data;

        });

and here is my HTML:

        <div ng-show="generalSearch">
        <div ui-grid="gridOptions" class="grid" ui-grid-pagination ui-grid-exporter ui-grid-auto-resize></div>

    </div>
    <div ng-hide="generalSearch">
        <div ui-grid="gridOptions3" class="grid" ui-grid-pagination ui-grid-exporter ui-grid-auto-resize></div>
    </div>

If "generalSearch" is "true" it is supposed to show the first grid. If it is false, it is supposed to show the second. It runs about 3 digest cycles (from what I can tell) to keep checking which of the grids to display.

Any assistance is greatly appreciated!

Rani Radcliff
  • 4,856
  • 5
  • 33
  • 60
  • Have you tried using ng-if instead of ng-show/hide? Also, maybe when you set the grid data, you could just set it in the visible grid, instead of in both? Just some ideas... – S. Baggy Aug 04 '16 at 21:13
  • I have tried "ng-switch" and "ng-if". I get the same result with both. I only set the data for both after trying a few things. Stil the same issue. But thanks for the suggestions! – Rani Radcliff Aug 05 '16 at 00:29
  • I'm in the lucky position of being able to enforce Chrome on my users, so am not familiar with the problem. Do you have the time to create a plunker of your scenario? – S. Baggy Aug 05 '16 at 00:43

0 Answers0