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

    How to manipulate JSON / Array for QTable

    Help
    2
    4
    425
    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.
    • E
      ebena last edited by ebena

      if the below array is used as data for Qtable

      user = { fname: "mike", lname : "duke", age : 35, hobby :"swimming"}
      

      we will get,

      fname lname age hobby
      mike duke 35 swimming

      Q1. how can I manipulate the user array and/or Qtable property to makes it into

      keys values
      fname mike
      lname duke
      age 35
      hobby swimming

      The user array would be dynamically loaded from API and content varies,

      Q2. is there any other quasar components for viewing/listing this as shown above?

      R 1 Reply Last reply Reply Quote 0
      • R
        rab @ebena last edited by

        @ebena

        Use q-table with :data=“userData” and define userData as a computed property:

        computed: {
            userData: function () {
              return Object.entries(this.user).map(([k,v]) => { return {key: k, value: v} })
            }
          }
        
        E 1 Reply Last reply Reply Quote 2
        • E
          ebena @rab last edited by

          @rab it work,
          thank you.

          1 Reply Last reply Reply Quote 0
          • E
            ebena last edited by ebena

            With above solution by @rab, master details using QTable is easily achievable.

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