Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions R/htable.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
htable <- function(outputId, clickId = NULL, readOnly = FALSE,
colHeaders=c("enabled", "disabled", "provided"),
rowNames=c("disabled", "enabled", "provided"),
minRows=0, minCols=0, width=0, height=0){
minRows=0, minCols=0, width=0, height=0,
readOnlyColumns = c(1,2,3)){

rowNames <- match.arg(rowNames)
colHeaders <- match.arg(colHeaders)
readOnlyColumns = jsonlite::toJSON(readOnlyColumns)

tagList(
singleton(tags$head(
Expand All @@ -48,9 +50,10 @@ htable <- function(outputId, clickId = NULL, readOnly = FALSE,
`data-htable-row-names`=rowNames,
`data-click-id`=clickId,
`data-read-only`=readOnly,
`data-read-only-columns`=readOnlyColumns, # ADDED
`data-min-rows`=minRows,
`data-min-cols`=minCols,
`data-width` = as.numeric(width),
`data-height` = as.numeric(height))
)
}
}
12 changes: 6 additions & 6 deletions R/render-htable.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ renderHtable <- function(expr, env = parent.frame(),
warning ("Factors aren't currently supported. Will convert using as.character().")

# Doesn't work with multiple columns at once, so iterate.
#TODO: Optimize
# TODO: Optimize
for (col in factorInd){
data[,col] <- as.character(data[,col])
}
Expand Down Expand Up @@ -63,13 +63,13 @@ renderHtable <- function(expr, env = parent.frame(),

#TODO: support updating of types, colnames, rownames, etc.

shinysession$session$sendCustomMessage("htable-change",
list(id=name,
changes=delta,
cycle=.cycleCount[[shinysession$token]][[name]]))
shinysession$sendCustomMessage("htable-change",
list(id=name,
changes=delta,
cycle=.cycleCount[[shinysession$token]][[name]]))

# Don't return any data, changes have already been sent.
return(list(cycle=.cycleCount[[shinysession$token]][[name]]))
}
}
}
}
Loading