Appsilon / reactable.extras

Extra features for reactable package
https://appsilon.github.io/reactable.extras/
38 stars 4 forks source link

[Feature]: Provide UI for searching #20

Open vibalre opened 1 year ago

vibalre commented 1 year ago

Guidelines

Description

Just like a common reactable, there should be an interface for the user to search values.

Problem

A search interface will make it easier for users to look for what they need in the data.

Proposed Solution

Add another UI on top of the reactable, a search box or text input, that will update the reactable data on the server-side based on the input.

Alternatives Considered

Since the pagination is handled on the server-side, searching will most likely happen on the server-side too.

Eduardodudu commented 1 year ago

I think this task is already working. I updated this code for using filtering, search and multiple selection and it worked.

library(shiny)
library(reactable)
library(reactable.extras)

mtcars_ultra <- purrr::map(
  seq(1L, 20000L, by = 1L),
  ~ {
    temp_df <- mtcars
    temp_df$make <- rownames(temp_df)
    rownames(temp_df) <- NULL
    temp_df <-
      dplyr::mutate(temp_df, id_row = paste0("id_", dplyr::row_number(), "_", .x))

    temp_df
  },
  .progress = TRUE
) |>
  purrr::list_rbind()

shinyApp(
  reactable_extras_ui("test"),
  function(input, output, server) {
    reactable_extras_server(
      "test",
      filterable = TRUE,
      searchable = TRUE,
      selection = "multiple",
      data = mtcars_ultra,
      columns = list(
        mpg = colDef(name = "Miles per Gallon"),
        cyl = colDef(name = "Cylinders"),
        disp = colDef(
          name = "Displacement",
          cell = button_extra("button")
        )
      ),
      total_pages = 4e4
    )
  }
)

Image

Eduardodudu commented 1 year ago

I noticed from the code example I made that the filter is actually only filtering what is being rendered per page and not actually filtering the whole dataset

feature_behavior

shahreyar-abeer commented 6 months ago

Any development on the search/filter functionality? What's the latest update?

At the moment, the filter only works for the rendered page as is mentioned in the previous comment by @Eduardodudu

joelnitta commented 3 months ago

+1 Adding a vote to please support this feature. Unfortunately without this, using reactable for large dataframes in Shiny doesn't really work, except for very basic displays like just showing tiny parts of the table one page at a time...

Thanks!