根据用户对Data.Tables的输入保存过滤器

时间:2014-11-03 07:43:47

标签: r shiny

我想从Data.Tables保存用户创建的过滤器供以后使用。特别是,我想确定进行了哪些排序和搜索。如果我正在GitHub上正确读取Shiny代码,则用户输入Data.Tables用于在函数dataTablesJSON(utils.R)中生成JSON文件。从Shiny应用程序内部访问这些参数的最佳方法是什么?我尝试了很多东西,但没有运气。最新尝试如下:

output$showSession <- renderPrint({
  murl <- session$registerDataObj(
    name = "MyTest",
    data = getdata(), # a function in my app that gets the 'active' dataset
    filter = function(data, req) {
      params <- URLdecode(rawToChar(req$rook.input$read()))
      q <- parseQueryString(params, nested = TRUE)
    }
  )
  print(murl)
})

# output from function above (not affected by inputs to Data.Tables)
[1] "session/1905f776d40a0b94a439ec3121796a9c/dataobj/MyTest?w="

# First few lines from function dataTablesJSON that gets the inputs I want 
dataTablesJSON <- function(data, req) {
  n <- nrow(data)
  # DataTables requests were sent via POST
  params <- URLdecode(rawToChar(req$rook.input$read()))
  q <- parseQueryString(params, nested = TRUE)
  .....

0 个答案:

没有答案