Is there a way to set the "select" options on a per-cell or per-row basis within a column in Tabulator?

Viewed 381

I would like to know if there is a way to set the Tabulator select options by both row and column? For example, the following Tabulator table setup contains a column definition with a "select" editor and parameters:

var table = new Tabulator("#myDiv"), {
    height: "100%",
    data: [],
    columns: [
        { title: "Project ID", field: "Projectid", responsive: 0, hozAlign: "center", editor: "autocomplete", editorParams: { values: projectIdList } },
        { title: "Phase Code", field: "Phasecode", responsive: 0, hozAlign: "center", editor: "select", editorParams: { values: laborPhaseCodes } } 
    ]
});

The "select" editor refers to an array to acquire its values inside the editorParams. This creates the same dropdown list of options for each row/cell in the Phasecode column.

What I would like to do is populate the values list with a set of options applicable to the selected value from the Projectid column on a row-by-row basis. Stated differently, the Projectid code will be different for each row and the Phasecode options are unique for each Projectid. Consequently, when the user makes a Projectid selection, I would like to refresh the Phasecode options for that row only.

Can it be done?

Any assistance is greatly appreciated.

1 Answers

Found the answer in the Tabulator documentation. Yes, it is possible to trigger each cell in a column to load its own list of options. From the Tabluator documentation:

editorParams: function (cell) { return { values: myArray}; }
Related