Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

CSS Classes Disappearing in UI5 Tables

Hi All,

I'm a bit puzzle by a bit of behavior that I'm seeing in the standard UI5 table.  I'm trying to use CSS to apply conditional formatting.  When I write cell values, I also add an appropriate css class in some instances, via a line of code like the one below:

currCell.addStyleClass("myCustomClass");

I have a separate css file, which is currently - for testing - setting the background of these cells red.  When the page loads, I see my red cells; but just for an instant.  Then everything goes back to the default theme.  When I inspect the cells in the browser's debugger, I see only the standard UI5 classes.

What might cause my custom classes to disappear? 

Thanks,

Dave

Tags:
replied

David, try to add delegate to the table instead of ready of doc

        oTable.addDelegate({

            onAfterRendering: function () {

var rows = oTable.getRows();

        for (var k = 0; k < rows.length; k++) {

            var cells = rows[k].getCells();

            for (var l = 0; l < cells.length; l++) {

                try{

                    var currCell = cells[l]

                    currCell.toggleStyleClass(repeatMask[k][l]);

                }

                catch(exc){

                    var catchMe = "just in case";

                }

            }

        }

}});

2 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question