Tabulator.js: Update editor list, when source values of list change

31 views Asked by At

I have a tabulator.js table running in a java-script. I am using an array of objects to provide the "list" feature the needed values for the pull-down list. I would like to change this list in the background and then use the updated values in the pull-down menu. Is there any chance, to tell the tabulator to update the list values?

var nameList=[{
        label:"Steve Boberson",
        value:"steve",
    },
    {
        label:"Bob Jimmerson",
        value:"bob",
    },
    {
        label:"Jenny Jillerson",
        value:"jenny",
    },
    {
        label:"Jill Betterson",
        value:"jill",
    }];

var table = new Tabulator("#my-table", {
data:policy, 
columns:[
    ...

    {title:"Test", field:"Test", width:100, editor:"list", 
      headerSort:false,headerFilter:"input", editable:editCheck, 
      editorParams:{values:nameList, filterDelay:1000,allowEmpty:true,listOnEmpty:true,freetext:false,multiselect:false,autocomplete:true}
    },  
    ...
], ...

Thanks Juergen

1

There are 1 answers

0
MatrixClient On

I think the trick is to use the valuesLookup setting:

{title:"Name", field:"name", editor:"list", editorParams:{
          valuesLookup:function(cell, filterTerm){
              return nameList
          }
}},