Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Provide UI for searching #20

Open
1 task done
vibalre opened this issue Apr 28, 2023 · 4 comments
Open
1 task done

[Feature]: Provide UI for searching #20

vibalre opened this issue Apr 28, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@vibalre
Copy link
Member

vibalre commented Apr 28, 2023

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.

@vibalre vibalre added the enhancement New feature or request label Apr 28, 2023
@Eduardodudu
Copy link
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

@Eduardodudu
Copy link
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

@shahreyar-abeer
Copy link

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
Copy link

+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
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants