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 Request] Add paging capability to the package #11

Open
happyshows opened this issue Sep 12, 2018 · 4 comments
Open

[Feature Request] Add paging capability to the package #11

happyshows opened this issue Sep 12, 2018 · 4 comments

Comments

@happyshows
Copy link

Hi,

I'm wondering if wrapping below feature (in bootstrap style) into the package is a good idea. I don't think there's any shiny ui related package has this feature.

https://www.r-bloggers.com/paging-widget-for-shiny-apps/

@DivadNojnarg
Copy link
Member

Hi,

as far as I know, there is https://github.com/JohnCoene/fullPage from @JohnCoene
But I can have a look a that in bootstrap 3

Thanks for the suggestion

@happyshows
Copy link
Author

It's a bit different depends on the use case. For me, I have a list of hundreds divs I want to show to end user, in a paged format. Think of it as google results or the paged table in DT.

@DivadNojnarg
Copy link
Member

From the widget repository (see https://github.com/wleepang/shiny-pager-ui), I replaced the UI, server and global by a custom code:

UI

shinyUI(
  dashboardPagePlus(
    header = dashboardHeaderPlus(
      enable_rightsidebar = TRUE,
      rightSidebarIcon = "gears"
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(
      pageruiInput('pager', page_current = 1, pages_total = length(all_pages)),
      hr(),
      uiOutput("current_page")
    ),
    rightsidebar = rightSidebar(),
    title = "DashboardPage"
  )
)

server

shinyServer(function(input, output, session) {
  output$current_page = renderUI({
    all_pages[[input$pager$page_current]]
  })
})

global

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
source('pagerui.R')
# I create 10 times the same UI
all_pages <- lapply(
  X = 1:10,
  FUN = function(i) {
    fluidRow(
      boxPlus(
        title = "Closable Box with dropdown", 
        closable = TRUE, 
        status = "warning", 
        solidHeader = FALSE, 
        collapsible = TRUE,
        enable_dropdown = TRUE,
        dropdown_icon = "wrench",
        dropdown_menu = dropdownItemList(
          dropdownItem(url = "http://www.google.com", name = "Link to google"),
          dropdownItem(url = "#", name = "item 2"),
          dropdownDivider(),
          dropdownItem(url = "#", name = "item 3")
        ),
        img(src = paste0("https://image.flaticon.com/icons/svg/135/13576", i,".svg"))
      )
    )
  }
)

I works very well. I think you can use it as it is. I could ask its author if I can include it in the package and provide more options.

@happyshows
Copy link
Author

Thanks for the quick turnaround, will test it later today.

About the inclusion to your package, since it's Apache 2 License, you can incorporate/modify it without explicit written approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants