title: Wide datatables causing scrollx to scroll back when applying filters
body: <p>I am able to render a datatable in my shiny app. However, whenever there is a wide table, the horizontal scroller gets back to it's initial position when you apply filters on the columns in the back. This issue occurs with numeric columns only.</p>
  <p>I was wondering if there is a way I can disable range-based filters (but keep the filters itself) or if there is any other workaround for this problem.</p>
  <p>I have searched github issues and stackoveflow prior to posting this question here since I couldn't find anybody having this problem.</p>
  <p>Here is a reproducible example along with pictures-</p>
  <pre class="lang-r prettyprint-override"><code>options(scipen = 99999) #converts the sci numbers to their regular format
  library(shiny)
  library(shinyjs)
  library(shinyWidgets)
  library(shinythemes)
  library(writexl)
  library(dplyr)
  library(DT)
  library(dplyr)
  
  mtcars_modified &lt;- mtcars %&gt;% dplyr::mutate(wt_2= wt,
                                              qsec_2 = qsec,
                                              am_2= am,
                                              mpg_2= mpg,
                                              gear_2 = gear,
                                              carb_2 = carb,
                                              disp_2 = disp,
                                              row_names_col= rownames(mtcars))
  
  ui &lt;- fluidPage(
    
    theme = shinythemes::shinytheme(&quot;simplex&quot;),
    
    shinyjs::useShinyjs(), # enables javascript/jQuery enhanchments
    
    
    # Create Right Side Text
    navbarPage( 
      
      id = &quot;navbar&quot;,
      title= div(HTML(&quot;G&lt;em&gt;T&lt;/em&gt;&quot;)),
      #windowTitle = &quot;GT&quot;,
      
      tabPanel(&quot;Data Set Info&quot;,
               
               materialSwitch(inputId = &quot;toggleSidebar&quot;, label = &quot;Toggle Panel: &quot;,
                              value = TRUE, status = &quot;warning&quot;),
               sidebarLayout(
                 # radio/action buttons
                 sidebarPanel(
                   
                   id = &quot;Sidebar&quot;,
                   
                   prettyRadioButtons(
                     inputId = &quot;controller&quot;,
                     label = &quot;Choose:&quot;, 
                     choices = c(&quot;About&quot;= 1,
                                 &quot;iris&quot;= 2,
                                 &quot;mtcars_modified&quot; = 3),
                     icon= icon(&quot;check&quot;),
                     selected = 1,
                     status = &quot;success&quot;,
                     animation=&quot;smooth&quot;
                   ),
                   
                   br(),
                   br()
                 ),
                 
                 #panel where output is shown from server
                 mainPanel(
                   id = &quot;main_panel&quot;,
                   
                   tabsetPanel(
                     id = &quot;hidden_tabs&quot;,
                     type = &quot;hidden&quot;,
                     tabPanelBody(
                       &quot;panel1&quot;, &quot;navigation&quot;
                     ),
                     
                     tabPanelBody(
                       &quot;panel2&quot;, 
                       tabsetPanel(
                         tabPanel(&quot;Data&quot;, DT::DTOutput('panel1_data')),
                         tabPanel(&quot;Summary&quot;, verbatimTextOutput(&quot;panel1_sum&quot;)),
                         tabPanel(
                           &quot;Plot&quot;
                         )
                       )
                     ),
                     tabPanelBody(
                       &quot;panel3&quot;,
                       tabsetPanel(
                         tabPanel(&quot;Data&quot;, DT::DTOutput('panel3_data')),
                         tabPanel(&quot;Summary&quot;, verbatimTextOutput(&quot;panel3_sum&quot;)),
                         tabPanel(
                           &quot;Plot&quot;
                         )
                       )
                     )
                   )
                 )
               )
      ) ,
      #resizes the navbar tabs/button
      tags$head(tags$style(HTML('.navbar-brand {width: 270px; font-size:35px; text-align:left;
                                font-family: &quot;serif&quot;;')))
    )
  )
  
  server &lt;- function(input, output, session) {
    
    # this event hides the side panel when toggled on/off
    observeEvent(input$toggleSidebar, {
      shinyjs::toggle(id = &quot;Sidebar&quot;, condition = input$toggleSidebar)
      if(!isTRUE(input$toggleSidebar)) {
        shinyjs::runjs(&quot;$('#main_panel').removeClass('col-sm-8').addClass('col-sm-12')&quot;)
      } else {
        shinyjs::runjs(&quot;$('#main_panel').removeClass('col-sm-12').addClass('col-sm-8')&quot;)
      }
      
    })
    
    
    # here we put all the data
    data_sets &lt;- list(df1 = data.frame(), 
                      df2= iris, 
                      df3 = mtcars_modified)
    
    # store current dataset in reactive so we can work with plot panels
    data_to_use &lt;- reactiveValues(name = &quot;df&quot;, data = data.frame())
    
    
    observeEvent(input$controller, {
      
      # skip first panel since it is used to display navigation
      updateTabsetPanel(session, inputId= &quot;hidden_tabs&quot;, selected = paste0(&quot;panel&quot;, input$controller))
      
      # enswure value is avilable throught selected tabSet
      req(input$controller)
      
      # get current data and df name
      data_to_use$data &lt;- data_sets[[as.numeric(input$controller)]]
      data_to_use$name &lt;- names(data_sets[as.numeric(input$controller)])
      
      # update table and sum
      output[[paste0('panel',  input$controller, '_data')]] &lt;- 
      DT::renderDT(server = FALSE, {
      DT::datatable(data_to_use$data,
                    filter = 'top',
                    extensions = 'Buttons',
                    options = list(scrollY = 600,
                                   scrollX = TRUE,
                                   dom = '&lt;&quot;float-left&quot;l&gt;&lt;&quot;float-right&quot;f&gt;rt&lt;&quot;row&quot;&lt;&quot;col-sm-4&quot;B&gt;&lt;&quot;col-sm-4&quot;i&gt;&lt;&quot;col-sm-4&quot;p&gt;&gt;',
                                   lengthMenu=  list(c(10, 25, 50, -1),
                                                     c('10', '25', '50','All')),
                                   buttons = list(
                                     list(extend = &quot;collection&quot;, text = &quot;Download&quot;,
                                          filename = &quot;data_excel&quot;,
                                          exportOptions = list(
                                            modifier = list(page = &quot;all&quot;)
                                          ),
                                          action = DT::JS(&quot;function ( e, dt, node, config ) {
                                    Shiny.setInputValue('Download_DATA', true, {priority: 'event'});}&quot;
                                          )
                                     )
                                   ),
                                   scrollCollapse= TRUE,
                                   lengthChange = TRUE,
                                   widthChange= TRUE,
                                   rownames = TRUE))})
  
      
      output[[paste0('panel',  input$controller, '_sum')]] &lt;- renderPrint(summary(data_to_use$data))
      
    })
    
    
  }
  
  #runs the app
  shinyApp(ui= ui, server= server)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/mxQRK.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mxQRK.jpg" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/AVkqI.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/AVkqI.jpg" alt="enter image description here" /></a></p>