Fetching a value from nested JSON object for a Data Table field
-
Hi,
If I have a JSON array as so and want to display the “second” as a column’s value for Quasar data table, how do I do it?However,
columns: [{ label: 'Something', field: 'multiple.second' }]
did not work.[ { "unique_id":297, "timerange":168, "multiple":{"first": "a", "second": "c"} }, { "unique_id":298, "timerange":168, "multiple":{"first": "b", "second": "d"} }]
-
Hi!
You can use format a cell
or slots<template slot="col-multiple" scope="cell"> <span class="light-paragraph">{{cell.row.second}}</span> </template>
-
This post is deleted! -
@leon Sorting does not work on the column fetching data using
slots
orformat (value) { return value.second }
-
It will in v0.15 datatable revamp because you’ll be able to specify your own sort method.
-
OHhhh tks @rstoenescu
-
@rstoenescu Hi,
If more than one JSON is imported as soimport table1 from 'data/one.json' import table2 from 'data/two.json'
and declared in data objectdata () { return { table1, table2 } }
How to specify the “field” value for keys from 2 different files?