Skip to content

[Feature]: Provide UI for searching #20

Open

Description

@vibalre

Guidelines

  • 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.

Activity

  1. Eduardodudu commented on Sep 13, 2023

    @Eduardodudu
    Contributor

    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

  2. Eduardodudu commented on Sep 16, 2023

    @Eduardodudu
    Contributor

    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

  3. shahreyar-abeer commented on Mar 6, 2024

    @shahreyar-abeer

    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

  4. joelnitta commented on Jun 4, 2024

    @joelnitta

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions