0

I’m having problems with ui-grid cellClass definition. When the grid is first shown, the definitions are right but, if the user scrolls vertically, the wrong class is defined. I’m following the Tutorial example. This is a simplified version of my gridOptions:

this.gridOptions = {
    enableFiltering: true,
    enableColumnMenu: false,
    columnDefs: [{ field: 'D1',
        cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) {
        if (grid.getCellValue(row,col) > 200) {
          $log.debug(grid.getCellValue(row,col));
          return 'red';
        }
    }}],
    data: myData
};

When the grid is shown, only cells with values above 200 have the red class. However, if the user scrolls, the cellClass function keeps getting called and the red class is randomly attributed, some cells with values bellow 200 have it, some with values above 200 doesn’ t. In the log, I only see values above 200.

I’ m using angular-ui-grid 3.0.0-rc.16

Update 1:

It seems to be a bug in ui-grid component. I was also able to reproduce in the tutorial example. If you go to http://ui-grid.info/docs/#/tutorial/111_cellClass only the Velity company, in the second column, should be blue. However, if you keep scrolling down and up quickly, eventually you will see other cells with blue text.

Update 2: I opened this issue. The problem also happens when you sort the grid.

2 Answers 2

1

The bug was fixed. Newer angular-ui-grid code does not have this problem.

Sign up to request clarification or add additional context in comments.

Comments

0

Check your "moduleName.css" file for class ".red".

this.gridOptions = {}

OR

$scope.gridOptions = {}

2 Comments

Thank you Fernando, but the css is fine. I don't think there is anything wrong with my code, since the problem can also be verified in ui-grid Tutorial. Anyways, any workaround on this would be welcome.
I had a problem using [ui.grid.paging] example on last version 3.0.0-rc.16. I find out that this feature just was available on version 3.0.0-rc.16 unstable, not released on Bower. Download on github.com/angular-ui/ui-grid.info/tree/gh-pages/release

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.