Rally grid color rows based on model

后端 未结 1 1476
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 01:02

I have a rallygrid that is configured to display two models: PortfolioItem/Feature and PortfolioItem/Rollup. I want to color them in the grid to differentiate them. I am not g

1条回答
  •  情歌与酒
    2021-01-26 01:51

    Your approach above with the viewConfig should work- I am going to file a defect on this. The root cause is that the Rally.ui.grid.GridView is blowing away the getRowClass function in its constructor (for internal browser testing purposes- ugghh) rather than checking if there was one supplied and calling that as well.

    You can see it the source for the constructor here: https://developer.help.rallydev.com/apps/2.0rc1/doc/source/GridView.html#Rally-ui-grid-GridView

    You should be able to work around it by just re-overriding the function before the view is rendered.

    [EDIT by asker] Added the following to the grid, and it worked:

    listeners: {
        beforerender: function(cmp) {
            console.log('beforerender');
            console.log('view',cmp);
            cmp.view.getRowClass = function(record, index, rowParams, store) {
                console.log('record',record); // still nothing logged in console
                console.log('index',index);
                return 'colorCodeGrid'; // class never added
            };
        }
    },
    

    UPDATE:

    I just fixed this in the nightly build, so this should no longer be an issue in public sdk builds beginning with the next public release after 2.0rc2.

    0 讨论(0)
提交回复
热议问题