Export only filtered data in a q-table

  • Hi,

    I’m new in vue and im still learning. What I would like to do is use the export feature of a q-table but export only the filtered data instead of everything. Im using the fonction from the exemple but i don’t how to work/get only the filtered data.

    Any idea ?

        exportTable () {
          // naive encoding to csv format
          const content = [ this.columns.map(col => wrapCsvValue(col.label)) ].concat(
            this.data.map(row => this.columns.map(col => wrapCsvValue(
              typeof col.field === 'function'
                ? col.field(row)
                : row[col.field === void 0 ? col.name : col.field],

    Thx in advance.

  • @lesourcil you can get the filtered rows by using a ref on your qtable and use filteredSortedRows computed prop, that’s the array you feed your exportTable function.

    So instead the line where it maps your data. Ie. this.data.map(... Use this.$refs.table.filteredSortedRows.map(....

    See the pen https://codepen.io/metalsadman/pen/LYNzrEE?editors=1010.

  • @metalsadman You rock !

Log in to reply