Git Product home page Git Product logo

Comments (3)

richardkunze avatar richardkunze commented on July 17, 2024

I'm sorry for answering so late! Having a busy time right now.

You surely can adjust the solumn widths, you just have to move the parameter to the cols_param-list.

shinyApp(
  ui = fluidPage(dq_handsontable_output("myTable", 9L)),
  server = function(input, output, session) {
    hw <- c("Hello", "my", "funny", "world!")
    data <- data.frame(A = rep(hw, 100L), B = hw[c(2:4, 100L)], C = 1:100, D = 100:1)
    dq_render_handsontable("myTable", data,
                           filters = c("Sel", "Text", NA, "Auto"), sorting = TRUE,
                           page_size = c(17L, 5L, 500L, 1000L),
                           table_param = list(rowHeaders=FALSE),
                           cols_param = list(colWidths=c(150, 250, 50, 50)),
                           col_param = list(list(col = 3L, format = "0.00")),
                           cell_param = list(list(row = 2:9, col = 2L, readOnly = TRUE)),
                           width_align = TRUE
    ) 
  }
)

Please note that horizontal stretching is activated by default, to disable this, use stretchH = "none" in the table parameters. And you should also activate width_align, to make sure the filters size corresponds to with the columns size.

I hope this helps.

from dqshiny.

ResourceX avatar ResourceX commented on July 17, 2024

Thanks! Very much helps. Your example works for me. I can't believe I didn't try that, but good point on width_align I would not have thought of that.

Does this package have all the same options as rhandsontable? Particularly, would the cell "comment" setting comments by df option work?

Thank you.

from dqshiny.

richardkunze avatar richardkunze commented on July 17, 2024

I'm glad I was able to help.

In general those functions support all options that rhandsontable supports. The comment thing is the only one which is a little bit tricky. I never really used comments, so I just found out ;)

In order to use the comment-parameter you have to enable the contextMenu (I really don't know why), which is disabled in my function by default. You can also define comments for individual cells with the cell_param, but for now you will always have to use to table comment parameter too.

shinyApp(
  ui = fluidPage(dq_handsontable_output("myTable", 9L)),
  server = function(input, output, session) {
    hw <- c("Hello", "my", "funny", "world!")
    data <- data.frame(A = rep(hw, 100L), B = hw[c(2:4, 100L)], C = 1:100, D = 100:1)
    comments <- data
    comments[c(TRUE, FALSE, TRUE),] <- NA
    dq_render_handsontable("myTable", data,
                           filters = c("Sel", "Text", NA, "Auto"), sorting = TRUE,
                           page_size = c(17L, 5L, 500L, 1000L),
                           table_param = list(comments = comments, contextMenu = TRUE),
                           cols_param = list(colWidths = c(150, 250, 50, 50)),
                           col_param = list(list(col = 3L, format = "0.00")),
                           cell_param = list(
                             list(row = 2:9, col = 2L, readOnly = TRUE),
                             list(row = 1, col = 1, comment = list(value = "This one is important!"))
                           ), width_align = TRUE
    )
  }
)

I will try to improve this behaviour with the next release.

from dqshiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.