Hello, i’m working on a grouptable, which indicates some process progress. is there a way to make a cell look like a progress bar?
What i came to so far is
table.setStyleProvider(new Table.StyleProvider<MyEntity>() {
//... standard things
if (entity.getProgress() == 0.5)
return "some-color";
return null;
});`
and code in styles.scss:
.some-color {
-linear-gradient(to right, green 49%, white 50%);
}
which brings me to a good progress bar emulation but without any dynamics cos i have no idea how to paramtrize the precentage in scss. Is there any common components or ways to achieve such a behavior in CUBA?
Take a look at ProgressBar component in the documentation. You can add a generator method to the column with progress property and create ProgressBar with a value from an entity.
For instance:
Also, you can use SCSS solution. You just need to generate styles for progress values. Using @each, we can iterate all values from the list. The following code will generate styles: “progress-style-10”, “progress-style-20” etc.
To customize ProgressBar you should override its styles (you can see them in the dev tools in your browser). SCSS solution is more light-weight because it doesn’t create an additional component that complicates the DOM tree.