0

How do we pass CSS arguments text-overflow: ellipsis or other arguments to renderDataTable in R shiny ? I have uneven text description in columns, by Autowidth the rows and columns are expanded based on the contents in respective cell.

I would like to be able to input "ellipsis", for user to be able to expand the cell to read text. Below is my server.r code. I tried to use the eg, explained in http://rstudio.github.io/DT/options.html. However, could not get what I am looking for. Appreciate if any inputs , suggestions are provided.

Thank you

0

1 Answer 1

1

Solved. The problem was with improper way I passed the arguments. The correct way is below.

  output$PM_output <- DT::renderDataTable(
    expr =  DT::datatable(data.frame.eg),
                          class   = 'cell-border stripe compact hover',
                          escape  = F, selection = 'multiple',
                          options = list(
                            autoWidth  = T,
                            LengthMenu = c(5, 30, 50),
                            columnDefs = list(list(
                              targets  = 6,
                              render   = JS(
                                "function(data, type, row, meta) {",
                                "return type === 'display' && data.length > 100 ?",                                    "'<span title=\"' + data + '\">' +
                                data.substr(0, 100) + '...</span>' : data;", "}"))),
                              pageLength = 1, server = T)))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.