Skip to content

Commit

Permalink
Fix pkgdown site
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Sep 17, 2024
1 parent 0b11aca commit 4bf32c3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ reference:
- delete_selected_rows
- trigger_download
- trigger_get_data
- trigger_get_spreadsheet_data
- trigger_get_sheet_data
- undo
- redo

Expand Down
66 changes: 65 additions & 1 deletion vignettes/articles/shiny.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library(shiny)
library(rtabulator)
```

## Basic application
## Basic Usage

Use `tabulatorOutput()` in the UI and `renderTabulator()` in the server part of your Shiny application:

Expand All @@ -36,3 +36,67 @@ server <- function(input, output) {
shinyApp(ui = ui, server = server)
```

## Interactions

**Triggers**

- `trigger_download()`
- `trigger_get_data()`
- `trigger_get_sheet_data()`

**Events**

- `{OUTPUT_ID}_row_clicked`
- `{OUTPUT_ID}_rows_selected`
- `{OUTPUT_ID}_data_filtered`
- `{OUTPUT_ID}_get_data`
- `{OUTPUT_ID}_get_sheet_data`
- ...

```{r, eval=FALSE}
library(shiny)
OUTPUT_ID <- "titanic"
data <- titanic(c("PassengerId", "Pclass", "Survived", "Fare"))
setup <- tabulator_options(selectable_rows = TRUE)
ui <- fluidPage(
titlePanel("Titanic Data"),
tabulatorOutput(OUTPUT_ID),
actionButton("submit", "Submit data to R")
)
server <- function(input, output) {
output$titanic <- renderTabulator({
tabulator(data, setup, editable = TRUE) |>
set_options_pagination() |>
set_formatter_progress("Fare") |>
set_tooltip("Fare") |>
set_formatter_tick_cross("Survived") |>
set_formatter_star("Pclass", number_of_stars = 3)
})
observeEvent(input$titanic_row_clicked, {
print(input$titanic_row_clicked)
})
observeEvent(input$titanic_rows_selected, {
print(input$titanic_rows_selected)
})
observeEvent(input$submit, {
print("Trigger get data")
tabulatorContext(OUTPUT_ID) |>
trigger_get_data()
})
observeEvent(input$titanic_get_data, {
print("Got data. Thanx!")
print(head(input$titanic_get_data))
})
}
shinyApp(ui = ui, server = server)
```

0 comments on commit 4bf32c3

Please sign in to comment.