q-table merge 2 fields into a single column



  • Is it possible to merge data from 2 fields in to a single column. The data is fetched from Db ans its there in row.



  • Does someone have any suggestions?

    Can we have a row object in format fn so that we can merge multiple fields?



  • using scoped slots

          <q-td auto-width slot="body-cell-user" slot-scope="props" :props="props">
            <div>[{{ props.row["userid"] }}] {{ props.row["lastname"] }}/ {{ props.row["companyname"] }}</div>
          </q-td>
    


  • @stuffy you can also do it in your columns array…
    ie.

    columns: [ // array of Objects
      // column Object definition
      {
        name: 'user',
        ...
        field: row => row.userid + ' ' + row.lastname + ' / ' + row.companyname, // can do here or at format
    
        // (optional) you can format the data with a function
        format: (val, row) => `${row.userid} ${row.lastname} \ / ${row.companyname}`, // can also do here
      },
    ...
    


  • @metalsadman This makes it easier. Thank you very much.


Log in to reply