flexboard shiny table horizontal and vertical scrollers not working











up vote
0
down vote

favorite












I just imported a csv data into R's flexdashboard and shiny and wanted to display the table inside one of the Chart grid and below is the code that I am using for that. I wanted vertical and horizontal scrollers to appear but it seems these are not working, any idea where I am wrong?



for data, you can use MTCARS for time-being.



Row 
-------------------------------------

### DATA

```{r}

data_set <- reactive({
inFile <- input$file1
if (is.null(inFile))
return(NULL) else return ( read.csv(inFile$datapath, header = input$header, stringsAsFactors =FALSE) )
})

output$tbl <-DT::renderDataTable({
if (is.null(data_set()))
return(NULL) else return (
DT::datatable(data_set(),
#style='bootstrap', class='table-condensed',
#editable=FALSE,
rownames=FALSE,
options = list(
scrollX = '400px', scrollY='360px',
searchHighlight=TRUE, pageLength = 4
))
)

})

div(style = "overflow-x: scroll; overflow-y: scroll;", DTOutput("tbl"))
```


Adding data:



structure(list(Gender = c("Male", "Male", "Male", "Male", "Male", 
"Male", "Male", "Male", "Male", "Male"), Height = c(73.847017017515,
68.7819040458903, 74.1101053917849, 71.7309784033377, 69.8817958611153,
67.2530156878065, 68.7850812516616, 68.3485155115879, 67.018949662883,
63.4564939783664), Weight = c(241.893563180437, 162.3104725213,
212.7408555565, 220.042470303077, 206.349800623871, 152.212155757083,
183.927888604031, 167.971110489509, 175.92944039571, 156.399676387112
), BMI = c(0.0443566151469252, 0.0343082174614673, 0.0387343292394288,
0.0427654457094595, 0.0422547891767963, 0.033653156898047, 0.0388739862001733,
0.0359564180086832, 0.039169072415755, 0.0388404008602306), probability = c(5.77831234737499e-06,
0.605952546493327, 2.62595199514618e-05, 0.000362873417265588,
0.00461190097404834, 0.911068673692331, 0.0496119303175197, 0.352335117615303,
0.139124546478089, 0.343426515632885)), row.names = c(NA, 10L
), class = "data.frame")









share|improve this question




























    up vote
    0
    down vote

    favorite












    I just imported a csv data into R's flexdashboard and shiny and wanted to display the table inside one of the Chart grid and below is the code that I am using for that. I wanted vertical and horizontal scrollers to appear but it seems these are not working, any idea where I am wrong?



    for data, you can use MTCARS for time-being.



    Row 
    -------------------------------------

    ### DATA

    ```{r}

    data_set <- reactive({
    inFile <- input$file1
    if (is.null(inFile))
    return(NULL) else return ( read.csv(inFile$datapath, header = input$header, stringsAsFactors =FALSE) )
    })

    output$tbl <-DT::renderDataTable({
    if (is.null(data_set()))
    return(NULL) else return (
    DT::datatable(data_set(),
    #style='bootstrap', class='table-condensed',
    #editable=FALSE,
    rownames=FALSE,
    options = list(
    scrollX = '400px', scrollY='360px',
    searchHighlight=TRUE, pageLength = 4
    ))
    )

    })

    div(style = "overflow-x: scroll; overflow-y: scroll;", DTOutput("tbl"))
    ```


    Adding data:



    structure(list(Gender = c("Male", "Male", "Male", "Male", "Male", 
    "Male", "Male", "Male", "Male", "Male"), Height = c(73.847017017515,
    68.7819040458903, 74.1101053917849, 71.7309784033377, 69.8817958611153,
    67.2530156878065, 68.7850812516616, 68.3485155115879, 67.018949662883,
    63.4564939783664), Weight = c(241.893563180437, 162.3104725213,
    212.7408555565, 220.042470303077, 206.349800623871, 152.212155757083,
    183.927888604031, 167.971110489509, 175.92944039571, 156.399676387112
    ), BMI = c(0.0443566151469252, 0.0343082174614673, 0.0387343292394288,
    0.0427654457094595, 0.0422547891767963, 0.033653156898047, 0.0388739862001733,
    0.0359564180086832, 0.039169072415755, 0.0388404008602306), probability = c(5.77831234737499e-06,
    0.605952546493327, 2.62595199514618e-05, 0.000362873417265588,
    0.00461190097404834, 0.911068673692331, 0.0496119303175197, 0.352335117615303,
    0.139124546478089, 0.343426515632885)), row.names = c(NA, 10L
    ), class = "data.frame")









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I just imported a csv data into R's flexdashboard and shiny and wanted to display the table inside one of the Chart grid and below is the code that I am using for that. I wanted vertical and horizontal scrollers to appear but it seems these are not working, any idea where I am wrong?



      for data, you can use MTCARS for time-being.



      Row 
      -------------------------------------

      ### DATA

      ```{r}

      data_set <- reactive({
      inFile <- input$file1
      if (is.null(inFile))
      return(NULL) else return ( read.csv(inFile$datapath, header = input$header, stringsAsFactors =FALSE) )
      })

      output$tbl <-DT::renderDataTable({
      if (is.null(data_set()))
      return(NULL) else return (
      DT::datatable(data_set(),
      #style='bootstrap', class='table-condensed',
      #editable=FALSE,
      rownames=FALSE,
      options = list(
      scrollX = '400px', scrollY='360px',
      searchHighlight=TRUE, pageLength = 4
      ))
      )

      })

      div(style = "overflow-x: scroll; overflow-y: scroll;", DTOutput("tbl"))
      ```


      Adding data:



      structure(list(Gender = c("Male", "Male", "Male", "Male", "Male", 
      "Male", "Male", "Male", "Male", "Male"), Height = c(73.847017017515,
      68.7819040458903, 74.1101053917849, 71.7309784033377, 69.8817958611153,
      67.2530156878065, 68.7850812516616, 68.3485155115879, 67.018949662883,
      63.4564939783664), Weight = c(241.893563180437, 162.3104725213,
      212.7408555565, 220.042470303077, 206.349800623871, 152.212155757083,
      183.927888604031, 167.971110489509, 175.92944039571, 156.399676387112
      ), BMI = c(0.0443566151469252, 0.0343082174614673, 0.0387343292394288,
      0.0427654457094595, 0.0422547891767963, 0.033653156898047, 0.0388739862001733,
      0.0359564180086832, 0.039169072415755, 0.0388404008602306), probability = c(5.77831234737499e-06,
      0.605952546493327, 2.62595199514618e-05, 0.000362873417265588,
      0.00461190097404834, 0.911068673692331, 0.0496119303175197, 0.352335117615303,
      0.139124546478089, 0.343426515632885)), row.names = c(NA, 10L
      ), class = "data.frame")









      share|improve this question















      I just imported a csv data into R's flexdashboard and shiny and wanted to display the table inside one of the Chart grid and below is the code that I am using for that. I wanted vertical and horizontal scrollers to appear but it seems these are not working, any idea where I am wrong?



      for data, you can use MTCARS for time-being.



      Row 
      -------------------------------------

      ### DATA

      ```{r}

      data_set <- reactive({
      inFile <- input$file1
      if (is.null(inFile))
      return(NULL) else return ( read.csv(inFile$datapath, header = input$header, stringsAsFactors =FALSE) )
      })

      output$tbl <-DT::renderDataTable({
      if (is.null(data_set()))
      return(NULL) else return (
      DT::datatable(data_set(),
      #style='bootstrap', class='table-condensed',
      #editable=FALSE,
      rownames=FALSE,
      options = list(
      scrollX = '400px', scrollY='360px',
      searchHighlight=TRUE, pageLength = 4
      ))
      )

      })

      div(style = "overflow-x: scroll; overflow-y: scroll;", DTOutput("tbl"))
      ```


      Adding data:



      structure(list(Gender = c("Male", "Male", "Male", "Male", "Male", 
      "Male", "Male", "Male", "Male", "Male"), Height = c(73.847017017515,
      68.7819040458903, 74.1101053917849, 71.7309784033377, 69.8817958611153,
      67.2530156878065, 68.7850812516616, 68.3485155115879, 67.018949662883,
      63.4564939783664), Weight = c(241.893563180437, 162.3104725213,
      212.7408555565, 220.042470303077, 206.349800623871, 152.212155757083,
      183.927888604031, 167.971110489509, 175.92944039571, 156.399676387112
      ), BMI = c(0.0443566151469252, 0.0343082174614673, 0.0387343292394288,
      0.0427654457094595, 0.0422547891767963, 0.033653156898047, 0.0388739862001733,
      0.0359564180086832, 0.039169072415755, 0.0388404008602306), probability = c(5.77831234737499e-06,
      0.605952546493327, 2.62595199514618e-05, 0.000362873417265588,
      0.00461190097404834, 0.911068673692331, 0.0496119303175197, 0.352335117615303,
      0.139124546478089, 0.343426515632885)), row.names = c(NA, 10L
      ), class = "data.frame")






      r shiny dt flexdashboard






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 4:35

























      asked Nov 9 at 14:49









      I_m_LeMarque

      1059




      1059
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Although I can't test this in your particular example since it is not minimally reproducible, I can share this code that works in one of my current production flexdashboards that is a datatable created within renderDT instead of renderDataTable to avoid naming conflicts. In this example, data_set() is reactive.



          The scrolling is controlled by the scrollX and scrollY options:



          renderDT({
          datatable(data_set(), style='bootstrap',
          class='table-condensed', editable=FALSE, rownames=FALSE,
          options = list(
          scrollX = '400px', scrollY='360px',
          searchHighlight=TRUE, order=list(0, 'asc'),
          ))
          })





          share|improve this answer























          • thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
            – I_m_LeMarque
            Nov 11 at 4:34











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228014%2fflexboard-shiny-table-horizontal-and-vertical-scrollers-not-working%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Although I can't test this in your particular example since it is not minimally reproducible, I can share this code that works in one of my current production flexdashboards that is a datatable created within renderDT instead of renderDataTable to avoid naming conflicts. In this example, data_set() is reactive.



          The scrolling is controlled by the scrollX and scrollY options:



          renderDT({
          datatable(data_set(), style='bootstrap',
          class='table-condensed', editable=FALSE, rownames=FALSE,
          options = list(
          scrollX = '400px', scrollY='360px',
          searchHighlight=TRUE, order=list(0, 'asc'),
          ))
          })





          share|improve this answer























          • thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
            – I_m_LeMarque
            Nov 11 at 4:34















          up vote
          1
          down vote













          Although I can't test this in your particular example since it is not minimally reproducible, I can share this code that works in one of my current production flexdashboards that is a datatable created within renderDT instead of renderDataTable to avoid naming conflicts. In this example, data_set() is reactive.



          The scrolling is controlled by the scrollX and scrollY options:



          renderDT({
          datatable(data_set(), style='bootstrap',
          class='table-condensed', editable=FALSE, rownames=FALSE,
          options = list(
          scrollX = '400px', scrollY='360px',
          searchHighlight=TRUE, order=list(0, 'asc'),
          ))
          })





          share|improve this answer























          • thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
            – I_m_LeMarque
            Nov 11 at 4:34













          up vote
          1
          down vote










          up vote
          1
          down vote









          Although I can't test this in your particular example since it is not minimally reproducible, I can share this code that works in one of my current production flexdashboards that is a datatable created within renderDT instead of renderDataTable to avoid naming conflicts. In this example, data_set() is reactive.



          The scrolling is controlled by the scrollX and scrollY options:



          renderDT({
          datatable(data_set(), style='bootstrap',
          class='table-condensed', editable=FALSE, rownames=FALSE,
          options = list(
          scrollX = '400px', scrollY='360px',
          searchHighlight=TRUE, order=list(0, 'asc'),
          ))
          })





          share|improve this answer














          Although I can't test this in your particular example since it is not minimally reproducible, I can share this code that works in one of my current production flexdashboards that is a datatable created within renderDT instead of renderDataTable to avoid naming conflicts. In this example, data_set() is reactive.



          The scrolling is controlled by the scrollX and scrollY options:



          renderDT({
          datatable(data_set(), style='bootstrap',
          class='table-condensed', editable=FALSE, rownames=FALSE,
          options = list(
          scrollX = '400px', scrollY='360px',
          searchHighlight=TRUE, order=list(0, 'asc'),
          ))
          })






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 9 at 20:35

























          answered Nov 9 at 20:29









          mysteRious

          2,0452514




          2,0452514












          • thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
            – I_m_LeMarque
            Nov 11 at 4:34


















          • thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
            – I_m_LeMarque
            Nov 11 at 4:34
















          thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
          – I_m_LeMarque
          Nov 11 at 4:34




          thanks for helping me out. I modified your code and update my question. but can you please provide explanation to 'options' in your code?
          – I_m_LeMarque
          Nov 11 at 4:34


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228014%2fflexboard-shiny-table-horizontal-and-vertical-scrollers-not-working%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word