18
Views
6
Comments
Solved
Cells
Application Type
Traditional Web

Hi friends , Hope You All fine

   Here I came with the quetsion as How to apply the coloring on cells (or) rows on table by those 'IF' conditios.

  where should I try this? how can I?

  Should I declare a class in CSS & call it on the table!

            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)

            {

                switch (e.Item.Cells[4].Text)

                {

                    case "90":

                        e.Item.ForeColor = System.Drawing.Color.Red;

                        break;

                    case "100":

                        e.Item.ForeColor = System.Drawing.Color.Green;

                        break;

                    default:

                        e.Item.ForeColor = System.Drawing.Color.Black;

                        break;

                }

            }



guys I need Your help...and believe any1 will

Solution

For maintainability I would not use extended properties for styling (creating inline styles). This goes against the OutSystems best practices.
As it makes it harder for future developers to find where the colour is set.

Rather use the class on cell level to conditionally set the background colour.
(Above example assumes you are developing in Reactive web)


as for traditional web you put the class in the extended properties (Just to point out, you add the class name not the styling)

Kind regards,
Eric

Solution

Hi Steve,
If I understood your question properly, you can define a class or style (dynamically) in the extended properties of a row or cell, for example:

Best regards,

Rúben

Solution

For maintainability I would not use extended properties for styling (creating inline styles). This goes against the OutSystems best practices.
As it makes it harder for future developers to find where the colour is set.

Rather use the class on cell level to conditionally set the background colour.
(Above example assumes you are developing in Reactive web)


as for traditional web you put the class in the extended properties (Just to point out, you add the class name not the styling)

Kind regards,
Eric

This post is for Traditional Web, you cannot do that in traditional... You need to use extended properties like I mentioned. 

Regards,

Rúben  

I over-read that tag thanks! Fixed my reply for traditional web. As doing inline styling still goes against best practices

Yes inline styling  is not recommend, only did because it was easy to show :)
Also just to complement, if you are using a class it should not be defined in the screen Style Sheet (this is also not recommended), you should have a module with a theme for your application.

Regards,

Rúben

You 100% got me on that one :) nice catch. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.