#101472
fimarapp
Member

This is the full code:


const fields = [
  'id: string',
  'name: string',
  'surname: string'
]

  const get_columns = () =>
    fields.map(field => {
      const f = field.split(':')
      return {
        visible: f[0] == 'id' ? false : true,
        label: $_(f[0]),
        dataField: f[0],
        dataType: f[1].trim()
      }
    })
  onMount(() => {
    // Create table
    Smart('#table', class {
      get properties() {
        return {
          keyboardNavigation: true,
          filtering: true,
          sortMode: 'one',
          selection,
          paging: true,
          freezeHeader: true,
          virtualization: true,
          dataSource: new Smart.DataAdapter({
            dataSource: source, dataFields: fields }),
          columns: get_columns()
        }
      }
    })