Skip to Content
DocsRowColor — table row coloring

RowColor — table row coloring

Entities can implement the RowColorProvider interface to control the background color of their rows in the portal table. The framework automatically attaches the color as a _rowColor field in entity data.

enum class RowColor { NONE, SUCCESS, WARNING, DANGER, INFO, MUTED } interface RowColorProvider { fun currentStatus(): RowColor? }

Color mapping

ValueColorCSS class
NONE— (default)none
SUCCESSgreenqp-tr-success
WARNINGyellowqp-tr-warning
DANGERredqp-tr-danger
INFOblueqp-tr-info
MUTEDgrayqp-tr-muted

Implementation

@Entity @Table(name = "task_run") @PortalEntity(label = "Task Runs", module = "System") class TaskRun : RowColorProvider { @Column(length = 20) @Enumerated(EnumType.STRING) @PortalField( label = "Status", order = 2, renderer = RendererType.SELECT, selectEnum = TaskRunStatus::class ) var status: TaskRunStatus = TaskRunStatus.RUNNING override fun currentStatus(): RowColor? = when (status) { TaskRunStatus.RUNNING -> RowColor.INFO // blue — in progress TaskRunStatus.COMPLETED -> RowColor.SUCCESS // green — success TaskRunStatus.ERROR -> RowColor.DANGER // red — error TaskRunStatus.CANCELLED -> RowColor.WARNING // yellow — cancelled } }

null returned by currentStatus() is equivalent to RowColor.NONE — no row coloring applied.

Last updated on