Search code examples
javascriptjsontabulator

Autocomplete values using array


Is it possible to use two arrays to insert data into values rather then hard coding the names of the users in tabulator.

One array would hold the username while the other would hold the actual name of the user.

{title:"Approver", field:"Approver", editor:"autocomplete", editorParams:
      {
    values:{
        "jd1":"John Doe",
        "mm12":"Marty McFly",
        }
    }
}

Solution

  • You should use Object.keys(values) and Object.values(values) to obtain username and fullname as two arrays, respectively.