Posted: 23 Dec 2019 22:57 EST Last activity: 24 Dec 2019 8:36 EST
Including shapes in UI
I need to include colored rectangles in the section based on the values fetched from DB. Is there any better approach apart from the brute-force one where we include as many icons as needed and using visible when for each of them?
I am working on a Movie booking Application. If the user selects a timeslot, I need to display colored rectangles to let the user know of the probability of he getting seats for that particular timeslot. Table contains timelsots and #.seats. The color of the rectangle should be based on the attribute Seat.
If we go with Charts, we need value for both the axes. In my case, Seats is the only attribute I am considering; so Charts didn't help me.
Here, in Pega community, we call it not "brute-force", but "best practice" :)
just for fun you could implement that solution:
Let's say, you're using a data page as a source and it has properties (fetched from DB): Name, Surname, Age. In Post Load Processing (or Response Data Transform, depends on what's the source of the data page), you could define new property, say, RectangleName, which will hold a name of icon/picture file (in a format "webwb/RectangleGreen.jpg" or class name "pi pi-rect pi-red" - these are only examples, not real names!).
Then you add a columnt with an Icon control, where you use Property as a source (or Icon Class, but not sure if it will work). That will do what you need.
But again - best practices get its name not just for fun.