RinteRface / fullPage

📄 fullPage.js, pagePiling.js and multiScroll.js for shiny
https://fullpage.rinterface.com
Other
111 stars 12 forks source link

remove jquery dependency to avoid conflict, closes #7 #10

Closed etiennebacher closed 3 years ago

etiennebacher commented 3 years ago

As pointed out in #7, htmlwidgets couldn't be displayed when using fullPage(). The reason mentioned here is that there's a conflict between jquery calls made by shiny and fullPage. Therefore, this PR removes the call to jquery.min.js (present in fullPage() and multiPage()), which is the reason why htmlwidgets were not displayed.

Here are some examples provided in #7, all htmlwidgets in this can be rendered with the fixed version:

library(shiny)
library(echarts4r)
library(highcharter)
library(plotly)
library(leaflet)
library(DT)

ui <- fullPage(
  menu = c("Full Page" = "link1"),
  fullSection(
    menu = "intro",
    "Widget testings",
    # echarts4r::echarts4rOutput("widget")
    # highcharter::highchartOutput("widget")
    # plotly::plotlyOutput("widget")
    # leaflet::leafletOutput("widget")
    # DT::dataTableOutput("widget")
    shiny::dataTableOutput("widget")
  )
)

server <- function(input, output){

    output$widget <- 
      # echarts4r::renderEcharts4r({
      # iris %>% echarts4r::e_charts(Sepal.Length) %>% echarts4r::e_scatter(Petal.Length)

      # highcharter::renderHighchart({
      #     highcharter::hchart(iris, "scatter", highcharter::hcaes(Sepal.Length, Petal.Length))

      # plotly::renderPlotly({
      #     plotly::plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)

      # leaflet::renderLeaflet({
      #     leaflet::leaflet() %>% leaflet::addTiles()

    # DT::renderDataTable({
    #     iris

    shiny::renderDataTable({
      iris

    })

  }

shinyApp(ui, server)
etiennebacher commented 3 years ago

Hi, I think this PR solves the issue with htmlwidgets. Could you verify and accept it if it works?

JohnCoene commented 3 years ago

I'm not sure we should remove the easing, I do not think that's included in jQuery core. For the rest, it seems you are correct; shiny loads shared libraries (including jQuery) so there is no need for it here: it causes clashes.

etiennebacher commented 3 years ago

I didn't remove the easing, only jquery-3.2.1/jquery.min.js

JohnCoene commented 3 years ago

My bad sorry.