table with (nested) object data



  • I’ve found that when defining the table columns, you cannot define 'field': 'item.subitem'

    while I found that it can be tricked by using

    format (value) {
      return value.subitem
    }
    

    it doesn’t work when it comes to sorting


  • Admin

    Quasar v0.11 (trying to release at the end of this week) will get enhanced sorting capabilities including specifying your own sorting method. This will allow you in your problem here.

    One more thing that you can do even with v0.10 is to compute/alter/map your data before you feed it to DataTable, so instead of using an object as cell value, use the object’s property directly in the computed data --> the result will be that you’ll feed DataTable directly with the value that you want to display. Example (let’s say you want for ‘col2’ to display ‘col2.secondprop’):

    Original Data:

    let orig = [
      {col1: 'some data', col2: {oneprop: 'sdfs', secondprop: '...'}},
      ....
    ]
    
    // Computed data:
    orig.map(row => {
      return {
        col1: row.col1,
        col2: row.col2.secondprop
      }
    }
    

Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.