shinynotes: Shiny notes module - server function

View source: R/note_crud.R

shinynotesR Documentation

Shiny notes module - server function

Description

Server function for the shinynotes module.

Usage

shinynotes(
  input,
  output,
  session,
  group_column,
  selected_group,
  group_options,
  table_id,
  db_conn,
  category_options = NA,
  style_options = default_styles()
)

Arguments

input

Standard shiny input

output

Standard shiny output

session

Standard shiny session

group_column

Column in table to group and filter notes by.

selected_group

Currently selected group column value.

group_options

Group column row value options.

table_id

Named list with member 'table' and 'schema' referring to a database table containing notes.

db_conn

An object that inherits from DBIConnection-class, typically generated by dbConnect()

category_options

Category column row value options. Useful if table is empty. Default is NA (retrieved from data)

style_options

Optional named list of CSS styles to apply to note panel elements.

Details

The style_options argument contains the following default values:

  • type = "paragraph"

  • header

    • color = "#4b2c71"

    • style = "font-weight: bold; text-decoration: underline;"

  • panel

    • status = "default"

    • background = "#fdfeff"

    • scrollY = "scroll"

    • max_height = "600px"

    • height = "100

    • padding = "4px"

    • width = "100

    • border_width = "2px"

    • border_radius = "4px"

    • border_style = "solid"

    • border_color = "#f5f5f5"

    • style = "text-align:left; margin-right:1px;"

  • paragraph_style = "margin: 0px 0px 1px;white-space: pre-wrap;"

  • bullet_style = "white-space: pre-wrap;"

  • hr_style = "margin-top:10px; margin-bottom:10px;"

  • ignoreCase = TRUE

Value

Module server component. Reactive expression containing the currently selected note data and database connection.

Examples

if(interactive()){
  shiny::callModule(
    module = shinynotes,
    id = "paragraph",
    style_options = shiny::reactive({
    list(
      "type" = "bullets",
      "header" = list("color" = "#ccc"),
      "panel" = list("scrollY" = TRUE)
      )
    }),
    group_column = "package",
    selected_group = shiny::reactive("shiny"),
    group_options = c("shiny", "shinyWidgets", "dplyr"),
    table_id = list(table = "scroll_demo", schema = "notes"),
    db_conn = connect_sqlite(auto_disconnect = FALSE)
  )
}


shinyNotes documentation built on March 7, 2023, 7:29 p.m.