0

我是制表符的新手,无法让它以正确的格式显示下拉列表数据。

我已经定义了列详细信息:

{
  title: "Status",
  field: "Status",
  width: 150,
  headerFilter: "input",
  editor: "select",
  editorParams: {
    listFormatter: populateStatusList
  }
},

如您所见,listFormatter调用函数populateStatusList。这个函数从一个已经填充的结构中构建一个字符串数组,并array.tostring()从函数中返回。

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

谁能帮我?

亲切的问候

4

1 回答 1

0

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

{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”

于 2018-11-22T22:11:38.883 回答