No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Fetching a value from nested JSON object for a Data Table field

    Help
    3
    7
    2670
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      we_bendthetrend last edited by we_bendthetrend

      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"}
      }]
      
      1 Reply Last reply Reply Quote 0
      • L
        leon last edited by leon

        Hi!
        You can use format a cell
        or slots

        <template slot="col-multiple" scope="cell">
            <span class="light-paragraph">{{cell.row.second}}</span>
          </template>
        W 2 Replies Last reply Reply Quote 0
        • W
          we_bendthetrend @leon last edited by we_bendthetrend

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • W
            we_bendthetrend @leon last edited by

            @leon Sorting does not work on the column fetching data using slots or format (value) { return value.second }

            1 Reply Last reply Reply Quote 0
            • rstoenescu
              rstoenescu Admin last edited by

              It will in v0.15 datatable revamp because you’ll be able to specify your own sort method.

              1 Reply Last reply Reply Quote 0
              • L
                leon last edited by

                OHhhh tks @rstoenescu

                1 Reply Last reply Reply Quote 0
                • W
                  we_bendthetrend last edited by we_bendthetrend

                  @rstoenescu Hi,
                  If more than one JSON is imported as so import table1 from 'data/one.json' import table2 from 'data/two.json' and declared in data object

                  data () {
                         return {
                           table1,
                           table2
                        }
                  }
                  

                  How to specify the “field” value for keys from 2 different files?

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post