Learn R Programming

toastui (version 0.4.0)

grid_style_row: Set grid row style

Description

Apply styles to an entire row identified by an expression.

Usage

grid_style_row(
  grid,
  expr,
  background = NULL,
  color = NULL,
  fontWeight = NULL,
  ...,
  class = NULL,
  cssProperties = NULL
)

Value

A datagrid htmlwidget.

Arguments

grid

A grid created with datagrid().

expr

An expression giving position of row. Must return a logical vector.

background

Background color.

color

Text color.

fontWeight

Font weight, you can use "bold" for example.

...

Other CSS properties.

class

CSS class to apply to the row.

cssProperties

Alternative to specify CSS properties with a named list.

Examples

Run this code
library(toastui)

datagrid(mtcars) %>%
  grid_style_row(
    mpg > 19,
    background = "#F781BE"
  )

datagrid(mtcars) %>%
  grid_style_row(
    vs == 0,
    background = "#E41A1C80",
    color = "#FFF"
  ) %>%
  grid_style_row(
    vs == 1,
    background = "#377EB880"
  )


# Use rlang to use character
library(rlang)
my_var <- "disp"
datagrid(mtcars) %>%
  grid_style_row(
    !!sym(my_var) > 180,
    background = "#F781BE"
  )




Run the code above in your browser using DataLab