reactable.extras icon indicating copy to clipboard operation
reactable.extras copied to clipboard

[Feature]: Provide UI for searching

Open vibalre opened this issue 2 years ago • 4 comments

Guidelines

  • [X] I agree to follow this project's Contributing 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.

vibalre avatar Apr 28 '23 11:04 vibalre

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 avatar Sep 13 '23 13:09 Eduardodudu

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

Eduardodudu avatar Sep 16 '23 10:09 Eduardodudu

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

shahreyar-abeer avatar Mar 06 '24 06:03 shahreyar-abeer

+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!

joelnitta avatar Jun 04 '24 04:06 joelnitta