Coder Social home page Coder Social logo

shiny-pager-ui's Introduction

Pager UI

A generic pager widget for R/Shiny based applications.

pager-ui widget

Features

  • Prev / Next buttons
  • Dynamically rendered page number buttons
    • displays all if โ‰ค 10 pages
    • smart display of spacer ... buttons for larger ranges
  • R functions pageruiInput() (for ui.R) and updatePageruiInput() (for server.R) make it simple to use in any Shiny application

Application

Provide paging abilities to data sets that require more processing / rendering than a table.

Installation

If you don't have the devtools package, install it:

install.packages('devtools')

This allows you to install packages directly from GitHub. Install this package:

devtools::install_github('wleepang/shiny-pager-ui')

Run the demo

Run the following to see the widget in action:

library(shinyPagerUI)
runExamplePagerUI()

The source for the example application is in:

inst/example_app

Use the widget

  1. In the global.R file (create it if it doesn't exist) add the line:
library(shinyPagerUI)
  1. In ui.R add the widget as needed using pageruiInput().
  2. In server.R use updatePageruiInput() in reactive contexts that need to update the widget.

Examples

In ui.R:

  • add a pager with id pager:
pageruiInput('pager')
  • add a pager-ui with id pager and initial current page of 5, initial total pages 10:
pageruiInput('pager', page_current = 5, pages_total = 10)

In server.R:

  • retrieve the current value from a pager-ui with id pager
pager_state = input$pager

## str(pager_state) 
##> List of 2
##>  $ page_current: int 1
##>  $ pages_total : int 4
  • update the current page of a pager-ui with id pager
updatePageruiInput(session, 'pager', page_current = new_page_current)
  • update the total number of pages available on a pager-ui with id pager
updatePageruiInput(session, 'pager', pages_total = new_pages_total)
  • update both the current page and total number of pages for a pager-ui with id pager
updatePageruiInput(session, 'pager', 
                   page_current = new_page_current, 
                   pages_total = new_pages_total)

shiny-pager-ui's People

Contributors

javierdiegofk avatar rickyking avatar wleepang avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.