Tab 中有多个 Select

Multiple Select in Tabulator

是否可以让一个 select 字段依赖于前一个字段?

用户 select 来自 select_1 的一个值,然后相应地 select_2 中的值发生变化。也许是自定义格式化程序?

const newCol = {//create column group
                title: oldRow.title,
                field: oldRow.field,
                columns: [
                  {
                    title: rowData.select1.title, field: rowData.select2.name, editor: 'select',
                    editorParams: {values: rowData.select1.values}
                  },
                  {
                    title: rowData.select2.title, field: rowData.select2.name, editor: 'select',
                    editorParams: function (cell) {
                      console.log(cell)
                      return {values: [1, 2, 3]}
                    }
                  },
                ],
              }

从上面我需要 select1 selected 值。

这行得通吗 Editors?:

"如果你想在select编辑器触发时生成选项,那么你可以将一个函数传递给editorParams,必须return两种格式之一的选项列表以上概述

{title:"Name", field:"name", editor:"select", editorParams:function(cell){
    //create a options list of all values from another column in the table
    var rows = table.getRows();
    var values = {};

    rows.forEach(function(row){
        var data = row.getData();

        values[data.fullname] = data.fullname;
    });

    return {values:values};
}

无需获取所有行,只需获取前一个 select 列的单元格值并使用它来构建当前 select 的选项。这取决于两列如何相互关联的细节。有关这方面的更多信息将会有所帮助。