weixin_39843986
weixin_39843986
2020-12-02 20:09

Cell Comments

Hi Jrowen,


 It seems that we should be able to add Comments to cells with hot_cell(1, 1, "Test Comment"),  however, it doesn't seem that comments are showing up when the cell in the output table is selected.

Am I missing something regarding the cell comments?
Also, is it possible to add comments to colHeader row?

Thanks a lot in advance! Allen

该提问来源于开源项目:jrowen/rhandsontable

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

18条回答

  • weixin_39843986 weixin_39843986 5月前

    It make sense that the CRAN version is not changed yet. Thanks for the quick fix. The comment matrix method of adding comments is also very nice.

    However, although I am able to make the comments work with the example code, the comments are not showing up when used in my shinyapp within a renderRHandsontable() in the server.R code. Am I missing something?

    Thanks! Allen

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    I was able to confirm the examples work with a simple shiny app. Can you send a minimal example of the code giving you trouble?

    On Mon, Feb 8, 2016, 3:26 PM Atan1988 notifications.com wrote:

    It make sense that the CRAN version is not changed yet. Thanks for the quick fix. The comment matrix method of adding comments is also very nice.

    However, although I am able to make the comments work with the example code, the comments are not showing up when used in my shinyapp within a renderRHandsontable() in the server.R code. Am I missing something?

    Thanks! Allen

    — Reply to this email directly or view it on GitHub https://github.com/jrowen/rhandsontable/issues/66#issuecomment-181555097 .

    点赞 评论 复制链接分享
  • weixin_39843986 weixin_39843986 5月前

    Jonathan,

    You are right. When I was trying to build a simpler code to post here, it works fine.

    I think the issue is actually that the comment in the cell seems to time out after a few seconds, so it appeared to not working on my more complicated app (takes a few button clicks, and a few renderUI statements before I get to see the table).

    Is there a way that I can make the comment stay permanently?

    I have included a simplified sample code below.

    Btw, I really like this package, which is enabling me to build a web-based insurance pricing model in shiny to replace the fairly complicated excel workbook. The tabgenerator function below is used to create tabs conditional on some user selections in the actual app.
    testapp.txt

    Thanks again! Allen

     R
    library(shiny)
    library(rhandsontable)
    
    tablecreater ")
      return(x)
    }
    
    cols %
          hot_table(highlightCol = TRUE, highlightRow = TRUE) %>%
          hot_cols(colWidths= kw*0.9) %>%
          hot_col(1, halign="htCenter", readOnly=F, strict =F, type="dropdown", 
                  source=c("US", "Can")) %>%
          hot_cell(1, 3, "Test comment")
        })
    })
    
    
    runApp(list(ui=ui,server=server))
    
    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    Cool app. I tried the example, and I don't have any issue seeing the comment. Which browser are you using? Also, have you tried looking at the JS console in the browser?

    点赞 评论 复制链接分享
  • weixin_39843986 weixin_39843986 5月前

    I am not familiar with the JS console, but I will look into that. I am using Google Chrome.

    This is actually the link to my app on shinyapps.io: When I first log in by clicking "Log in" and "Submit", the comment will show up in the version table, however, if I click "log in" and "Submit" again, the comment will disappear.

    If I click "Open Rater", the comments won't show up at all in the rendered tabs. I think it might be something related to my complicated structure, but it can also be just related to my browser.

    Also, for my simple app, the comment only disappear in my Rstudio environment, but it would actually stick if I "Open Browser".

    Thanks! Allen

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    It's hard to debug without the source code, but the html source shows additional comment tags added after each login click (the reset if the page is reloaded). I'd take a look at your code to be sure the comments are cleared when then login link is clicked.

    On Tue, Feb 9, 2016, 11:42 AM Atan1988 notifications.com wrote:

    I am not familiar with the JS console, but I will look into that. I am using Google Chrome.

    This is actually the link to my app on shinyapps.io: https://allentanironshore.shinyapps.io/EnviroRater/ When I first log in by clicking "Log in" and "Submit", the comment will show up in the version table, however, if I click "log in" and "Submit" again, the comment will disappear.

    If I click "Open Rater", the comments won't show up at all in the rendered tabs. I think it might be something related to my complicated structure, but it can also be just related to my browser.

    Also, for my simple app, the comment only disappear in my Rstudio environment, but it would actually stick if I "Open Browser".

    Thanks! Allen

    — Reply to this email directly or view it on GitHub https://github.com/jrowen/rhandsontable/issues/66#issuecomment-181976198 .

    点赞 评论 复制链接分享
  • weixin_39843986 weixin_39843986 5月前

    Thanks! I am sorry about not posting the source code. I didn't think of a way to create a simplified code, however I got some inspiration from your reply.

    I think this code demonstrates the problem I have. The comment will go away after a second set of "Log in" and "Submit" clicks.

     R
    library(shiny)
    library(rhandsontable)
    
    tablecreater ")
      return(x)
    }
    
    cols %
          hot_table(highlightCol = TRUE, highlightRow = TRUE) %>%
          hot_cols(colWidths= kw*0.9) %>%
          hot_col(1, halign="htCenter", readOnly=F, strict =F, type="dropdown", 
                  source=c("US", "Can")) %>%
          hot_cell(1, 3, "Test comment")
        })
    })
    
    
    runApp(list(ui=ui,server=server))
    

    testapp.txt

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    The widget's resize function calls updateSettings on the table, which apparently causes the table to lose the comments. This seems like a bug in handsontable. Thanks for being persistent.

    点赞 评论 复制链接分享
  • weixin_39843986 weixin_39843986 5月前

    Thanks! Looking forward to the fixed version.

    Allen

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    I pushed a temporary fix to the dev version that should preserve comments.

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    Please re-open if this is still an issue.

    点赞 评论 复制链接分享
  • weixin_39719042 weixin_39719042 5月前

    Hi
    Here's an exact issue https://github.com/handsontable/handsontable/issues/3221 but I was calling updateSettings to change rowHeaders the comments stayed the same. Can you share more details when there're gone?

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    You're right, there's a bug with the comments. I'll push a fix to the dev version shortly. Thanks for reporting.

    On Mon, Feb 1, 2016 at 9:25 AM Atan1988 notifications.com wrote:

    Hi Jrowen,

    It seems that we should be able to add Comments to cells with hot_cell(1, 1, "Test Comment"), however, it doesn't seem that comments are showing up when the cell in the output table is selected

    Am I missing something regarding the cell comments? Also, is it possible to add comments to colHeader row?

    Thanks a lot in advance! Allen

    — Reply to this email directly or view it on GitHub https://github.com/jrowen/rhandsontable/issues/66.

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    Let me know if you're still running into problems with the comments. Thanks again for reporting.

    点赞 评论 复制链接分享
  • weixin_39843986 weixin_39843986 5月前

    Thanks, Jonathan! I got busy with some other work and put the project aside. I would assume that I need to re-install the rhandsontable package, right?

    Thanks again! Allen

    点赞 评论 复制链接分享
  • weixin_39843986 weixin_39843986 5月前

    Jonathan,

    
       I updated my R to 3.2.3, and the rhandsontable package. However, I still can't see comments when hovering the cell. 
    
       I tried following code in the introduction:
       "DF = data.frame(val = 1:10, bool = TRUE, big = LETTERS[1:10],
                small = letters[1:10],
                dt = seq(from = Sys.Date(), by = "days", length.out = 10),
                stringsAsFactors = FALSE)
    
       rhandsontable(DF) %>%
                 hot_cell(1, 1, "Test comment")"
    

    Thanks, Allen

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    For now, you need to install the dev version.

    On Mon, Feb 8, 2016, 12:11 PM Atan1988 notifications.com wrote:

    Thanks, Jonathan! I got busy with some other work and put the project aside. I would assume that I need to re-install the rhandsontable package, right?

    Thanks again! Allen

    — Reply to this email directly or view it on GitHub https://github.com/jrowen/rhandsontable/issues/66#issuecomment-181442401 .

    点赞 评论 复制链接分享
  • weixin_39928686 weixin_39928686 5月前

    You can install the dev version using

    
    devtools::install_github("jrowen/rhandsontable")
    

    You can see an example at http://jrowen.github.io/rhandsontable/#cell-comments. Let me know if you still run into any problems.

    点赞 评论 复制链接分享

相关推荐