renderDatatable not working on first load but does on second

...I have two instances of renderdatatable in my code. one is working fine and loading in the first load. but other is not working on first load but does work on second load.

Here is the working code that loads in the first load.

Theme based keywords {data-navmenu="Competition"}
=======================================================================

Column {.sidebar}
-----------------------------------------------------------------------

```{r}

Data43 <- j1

themelevel11 <- factor(Data43$theme, levels =sort(unique(Data43$theme)))

selectInput('themelevel11', 'Theme:', c("Select",levels(factor(themelevel11))), selected = "Select")

Column

Theme based keywords



dataset43 <- reactive({
  subset(Data43,
         (input$themelevel11 == "Select" | themelevel11 %in% input$themelevel11) 
  )
})


DT::renderDataTable(
  dataset43(), 
  filter = 'top',
  extensions = 'FixedColumns',
  options = list(
    pageLength = 10, 
    autoWidth = TRUE,
    scrollY = '400px',  
    scrollX = TRUE,
    fixedColumns = list(leftColumns = 3),    
    order = list(list(2, 'desc')), 
    columnDefs = list(
      list(className = 'dt-center', targets = '_all'),
      list(className = 'dt-left', targets = 0),
      list(visible = FALSE, targets = c(3))  
    ) 
  )  
)

The below code doesn't work on first scroll and just showing 420 rows count without any data, however the data gets loaded on the second scroll.

Long titles {data-navmenu="Technical SEO"}
=======================================================================

Column {.sidebar}
------------------------------------------------------------------
```{r}

Data36 <- c1

themelevel10 <- factor(Data36$theme, levels = sort(unique(Data36$theme)))

selectInput('themelevel10', 'Theme:', c("Select",levels(factor(themelevel10))), selected = "Select")



Column 1


dataset36 <- reactive({
  subset(Data36,
         (input$themelevel10 == "Select" | themelevel10 %in% input$themelevel10) 
  )
})


DT::renderDataTable(dataset36,
            options = list(
              pageLength = 10, 
              autoWidth = TRUE,
              scrollY = '450px',  
              scrollX = TRUE,
              order = list(list(5, 'desc')),
              columnDefs = list(
                list(className = 'dt-center', targets = '_all'),
                list(className = 'dt-left', targets = 0),
                list(visible=FALSE, targets=c(6))
              )
            )
  )

What could be the reason. I want the second code to be loaded in the first scroll when "Select" filter is chosen.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.