Last active
February 9, 2022 03:59
-
-
Save timelyportfolio/b8001318ce3e25b6920a0f20e9db374e to your computer and use it in GitHub Desktop.
Revisions
-
timelyportfolio revised this gist
Jul 4, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ browsable(tagList( rhandsontable( data = mtcars, rowHeaders = NULL, # see http://jsfiddle.net/pn3rv48p/ for another example with afterGetColHeader afterGetColHeader = htmlwidgets::JS(htmltools::HTML( sprintf( " -
timelyportfolio revised this gist
Jul 4, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,8 @@ sprintf( " function(i, TH) { var titleLookup = %s; // destroy previous tippy instance if it exists if(TH.hasOwnProperty('_tippy')) {TH._tippy.destroy()} // initialize tooltip and set content to description from our titleLookup tippy(TH, { content: titleLookup[i].desc, -
timelyportfolio created this gist
Jul 4, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ library(rhandsontable) library(htmltools) browsable(tagList( rhandsontable( data = mtcars, rowHeaders = NULL, // see http://jsfiddle.net/pn3rv48p/ for another example with afterGetColHeader afterGetColHeader = htmlwidgets::JS(htmltools::HTML( sprintf( " function(i, TH) { var titleLookup = %s; // initialize tooltip and set content to description from our titleLookup tippy(TH, { content: titleLookup[i].desc, }); } ", # use column information from ?mtcars # sprintf will place this json array of objects in our script above at %s jsonlite::toJSON( read.delim( textConnection(' [, 1] mpg Miles/(US) gallon [, 2] cyl Number of cylinders [, 3] disp Displacement (cu.in.) [, 4] hp Gross horsepower [, 5] drat Rear axle ratio [, 6] wt Weight (1000 lbs) [, 7] qsec 1/4 mile time [, 8] vs Engine (0 = V-shaped, 1 = straight) [, 9] am Transmission (0 = automatic, 1 = manual) [,10] gear Number of forward gears [,11] carb Number of carburetors' ), header = FALSE, col.names = c("loc","id","desc"), stringsAsFactors = FALSE ), auto_unbox = TRUE ) ) )) ), # use tippy/bootstrap since Bootstrap 3 tooltips are awful # and don't place nicely with handsontable # better with htmlDependency but this works fine tags$script(src = "https://unpkg.com/@popperjs/core@2"), tags$script(src = "https://unpkg.com/tippy.js@6") ))