Skip to content

Commit

Permalink
fix: selecting only name, definition and unit columns
Browse files Browse the repository at this point in the history
  • Loading branch information
plecharpent committed Oct 12, 2020
1 parent 61292d4 commit ca206ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 8 additions & 6 deletions R/find_stics_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ find_stics_names <- function(viewer = "pane") {

if (nrow(l)) l <- l[,1:3]

cat("writing table file ...")
write.csv(l, file="/tmp/test.csv", sep = ";")

return(l)
})

Expand Down Expand Up @@ -209,7 +212,7 @@ find_stics_names <- function(viewer = "pane") {
# )


output$table <- DT::renderDataTable(DT::datatable(names_table(),
output$table <- DT::renderDataTable(DT::datatable(get_usefull_cols(names_table(), 1:3),
options = list(searching = FALSE),
caption = "Click on a line to select or unselect it"),
server = TRUE)
Expand All @@ -229,7 +232,7 @@ find_stics_names <- function(viewer = "pane") {
# )


output$table <- DT::renderDataTable(DT::datatable(names_table(),
output$table <- DT::renderDataTable(DT::datatable(get_usefull_cols(names_table(), 1:3),
options = list(searching = FALSE),
caption = "Click on a line to select or unselect it"),
server = TRUE)
Expand All @@ -250,7 +253,7 @@ find_stics_names <- function(viewer = "pane") {
# caption.width = getOption("xtable.caption.width", NULL)
# )

output$table <- DT::renderDataTable(DT::datatable(names_table(),
output$table <- DT::renderDataTable(DT::datatable(get_usefull_cols(names_table(), 1:3),
options = list(searching = FALSE),
caption = "Click on a line to select or unselect it"),
server = TRUE)
Expand All @@ -271,7 +274,7 @@ find_stics_names <- function(viewer = "pane") {
# caption.width = getOption("xtable.caption.width", NULL)
# )

output$table <- DT::renderDataTable(DT::datatable(names_table(),
output$table <- DT::renderDataTable(DT::datatable(get_usefull_cols(names_table(), 1:3),
options = list(searching = FALSE),
caption = "Click on a line to select or unselect it"),
server = TRUE)
Expand All @@ -292,9 +295,8 @@ find_stics_names <- function(viewer = "pane") {
# caption.width = getOption("xtable.caption.width", NULL)
# )

dt_names <- names_table()

output$table <- DT::renderDataTable(DT::datatable(dt_names,
output$table <- DT::renderDataTable(DT::datatable(get_usefull_cols(names_table(), 1:3),
options = list(searching = FALSE),
caption = "Click on a line to select or unselect it"),
server = TRUE)
Expand Down
10 changes: 10 additions & 0 deletions R/insert_stics_name.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ get_names_list <- function(type = "par", stics_version = "last") {
}


get_usefull_cols <- function(df, ids) {

if (!all(dim(df))) return(df)

real_ids <- intersect(1:ncol(df), ids)

if (!length(real_ids)) return(data.frame())

return(subset(df,select = real_ids))
}

format_name <- function(name, type = "par", kind = NULL, inline = FALSE, latex = FALSE ) {

Expand Down

0 comments on commit ca206ba

Please sign in to comment.