r - DT::datatable clearing default filters -


i put default filters on dt::datatable in shiny application. i'm able default filters in place, removing filters not behaving expect.

example 1

an example of datatable no filters:

library(shiny) library(dt)  shinyapp(   ui =     fluidpage(       dt::datatableoutput("mtcars")     ),    server =     shinyserver(function(input, output, session){       output$mtcars <-          dt::renderdatatable({           mtcars$gear <- factor(as.character(mtcars$gear))           datatable(             data = mtcars,             filter = "top",             options =                list(                 pagelength = 50               )           )         })     }) ) 

notice in example, when manually select "3" under gear column, little gray box appears let's know "3" selected.

enter image description here

then, when out of filter selection, there little x in circle lets clear filter.

enter image description here

example 2

in example, i've preloaded "3" filter when datatable loads.

shinyapp(   ui =     fluidpage(       dt::datatableoutput("mtcars")     ),    server =     shinyserver(function(input, output, session){       output$mtcars <-          dt::renderdatatable({           mtcars$gear <- factor(as.character(mtcars$gear))           datatable(             data = mtcars,             filter = "top",             options =                list(                 pagelength = 50,                 searchcols = list(null, null, null, null,                                   null, null, null, null,                                   null, null, list(search = '["3"]'), null)               )           )         })     }) ) 

notice filter box doesn't have x in circle clear out filter. if click in box , click out without making changes, circle appear, take no action when clicked. way clear filter select value , clear out values if hadn't preloaded filters.

enter image description here

anyone else had problem before?

edit: cheesy imagery helps clarify discrepancy between two. i'm using dt version 0.1.57 (most recent on github)

enter image description here


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -