shiny - How to mark last row in results of DataTable using R -


i mark (for instance bold) last row in data table generated using dt package. let's have table iris dataset:

library(dt) datatable(iris) 

results: enter image description here

so have 150 rows , bold only 150 row.

edit: @bigdatascientist let me clear this. have this:

 output$tbl <-      dt::renderdatatable(       data() %>% # let's iris data - doesn't matter       bind_rows(summarise(data(), sum = "sum", = sum(a), b = sum(b),                             c = sum(c), d = sum(d),                             e = sum(e), f = sum(f))) %>%       mutate(sum = rowsums(.[2:6])),     extensions = 'buttons',      options = list(       dom = 'blfrtip',       lengthmenu = list(c(-1, 5, 10, 15, 20, 25), c('all', '5', '10', '15', '20', '25')),       buttons = list('copy',                      list(extend = 'excel',                           filename = 'report'),                      list(extend = 'pdf',                           filename = 'report'),                      'print'),      rownames = false,      server = false     ) %>%     formatstyle(      target = "row",      fontweight = styleequal(dim(.)[1], "bold")     )  ) 

so, add bolding last row; in case, sum of columns; pipeline, in 1 piece (one pipeline).

this page you, if adapt code bit:

formatstyle(   datatable(iris), 0, target = "row",   fontweight = styleequal(dim(iris)[1], "bold") ) 

edit: asked (in addition) data passed reactive() pipes in shiny. well, can offer workaround. not familiar pipes, how pass several arguments.

shinyapp(   ui = fluidpage(fluidrow(column(12, dt::datatableoutput('tbl')))),   server = function(input, output) {     irisreact <- reactive(iris)     dimirisreact <- reactive(dim(iris)[1])         output$tbl = dt::renderdatatable(       irisreact() %>% datatable() %>% formatstyle(         0, target = "row",         fontweight = styleequal(dimirisreact(), "bold")       )     )   } ) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -