无法使Tabulator选择编辑器正常工作

时间:2018-11-22 09:26:02

标签: tabulator

我是制表人的新手,无法以正确的格式显示Droplist数据。

我因此定义了列详细信息:

library(ggplot2)

mean <- 6
sd <- 1

X <- rnorm(100000, mean = mean, sd = sd)
Y <- dnorm(X, mean = mean, sd = sd)
Y_p <- pnorm(X, mean = mean, sd = sd)

ch_vars <- function(X){
  nu_vars <- c()
  for (x in X){
    nu_vars <- c(nu_vars, (1/(1 + exp(-x + 5))))
  }
  return(nu_vars)
}

nu_X <- ch_vars(X)
nu_Y <- ch_vars(Y)

data <- data.frame(x = X, y = Y, Y_p = Y_p, x = nu_X, y = nu_Y)

# Cumulative distribution 
ggplot(data = data) +
  geom_line(aes(x = X, y = Y_p))

# Distribution of initial data
ggplot(data = data_ch, aes(x = X)) +
  geom_histogram(aes(y = ..density..), bins = 25, fill = "red", color = "black")

# Distribution of transformed data
ggplot(data = data, aes(x = nu_X)) +
  geom_histogram(aes(y = ..density..), bins = 25, fill = "green", color = "black")

如您所见,{ title: "Status", field: "Status", width: 150, headerFilter: "input", editor: "select", editorParams: { listFormatter: populateStatusList } }, 调用函数listFormatter。该函数从一个已经填充的结构中构建一个字符串数组,并从该函数返回populateStatusList

制表符下拉列表的确显示了字符串,但是水平显示在一条长行上,而不是我期望的垂直显示(即,它实际上并没有掉线)。

有人可以帮助我吗?

亲切的问候

1 个答案:

答案 0 :(得分:0)

listFormatter 仅应用于布局传递给编辑器的列表项,列表中每个项的值应传递给 值属性

{title:"Gentlemen", field:"names", editor:"select", editorParams:{
    listFormatter:function(value, title){ //prefix all titles with the work "Mr"
        return "Mr " + title;
    },
    values:{
        "steve":"Steve Boberson",
        "bob":"Bob Jimmerson",
        "jim":"Jim Stevenson",
    }
}}

在上面的示例中,列表格式化程序将创建传递到 values 属性的标题的列表,并在每个标题之前添加字符串“ Mr”