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

    [Solved] DataTable - Syntax of rendering data (what's the difference)

    Framework
    2
    3
    330
    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.
    • S
      Stanley last edited by Stanley

      When reading source code from file “table-features.vue” and “table-customize.vue” in the online documetation, I found there are two ways to render data based on row level. I just wonder what’s the difference?
      The first way is from table-features.vue at line 218

      <q-table>
        <q-tr slot="body" slot-scope="props" :props="props">
          <q-td key="[fieldName]" :props="props"> {{ props.row.[fieldName] }} </q-td>
      

      The second way is from table-customize.vue at line 164

      <q-table>
        <template slot="body" slot-scope="props">
          <q-tr :props="props">
            <q-td key="[fieldName]" :props="props">{{ props.row.[fieldName] }}</q-td>
      
      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by s.molinari

        The bottom one is the old way of creating content for slots, the top one the new way. Before with slots, you had to define a template to inject that content into a slot. With newer versions of Vue (can’t recall the actual version), you can inject content into a slot with any type of element, like a <tr> instead of a <template>.

        Scott

        S 1 Reply Last reply Reply Quote 0
        • S
          Stanley @s.molinari last edited by

          @s-molinari Thanks for the explanation!

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