question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tables Custom rendering

See original GitHub issue

I am a totally newbie here.

In the Tables Custom rendering example, it says:

<template slot="name" scope="field">
      {{field.name.first}} {{field.name.last}}
</template> 

So, why in the example after “Custom rendering” section:

<template slot="actions" scope="item">
       <b-btn size="sm" @click="details(item.item)">Details</b-btn>
</template>

shouldn’t the scope be “field” ?

And in fact, I have tried both (scope=“item” and scope=“field” ), but the button won’t show up in my page… I am totally lost… (but the custom rendering button seems to work on jsfiddle no problem…)

Here is snippet of my code:

<template>
<div>
<b-table striped bordered hover show-empty responsive :items="items" :fields="fields">
      <template slot="wonumber" scope="item">
        {{item.wonumber}}
      </template>
      <template slot="status" scope="item">
        {{item.value.status}}
      </template>
      <template slot="actions" scope="field">
        <b-btn variant="primary" @click="details(item.item)">Change Status</b-btn>
      </template>-->
    </b-table>
</div>
</template>
<script>
export default {
  data() {
    return {
      items: [
          {
          wonumber: 'wonumber_001',
          status: true
        }, {
          wonumber: 'wonumber_002',
          status: true
        }
      ],
      fields: {
        wonumber: {
          label: 'WO Number'
        },
        status: {
          label: 'Status'
        },
        actions: {
          label: 'Actions'
        }
      }
    }
  },
  methods: {
    details(item) {
      alert(JSON.stringify(item))
    }
  }
}
</script>

I am using the newest 0.16.1, everything else seem working properly, except the custom button won’t show up… Thank you in advance for any tips.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
neildchencommented, May 24, 2017

Hello @alexsasharegan I already have. Thank you.

2reactions
tmorehousecommented, May 20, 2017

Check out PR #433

I’ve added some clarity and improved example for scope slots. I know the documentation (and scoped slots) confused me a bit, so I’ve updated it to make usage more clear (using item or field as the scope variable can be confusing with the items and fields data).

@neildchen The scope="variable" creates a local template variable that contains the properties passed to the named slot. The variable will contain the properties:

  • value - the fields value (or null if a virtual column/field)
  • item - the entire item record object
  • index - the row number (zero based counter)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Rendering • reactable - GitHub Pages
Custom Rendering ; Easier to use but more static; Render once, when the table is created; Supports htmltools and htmlwidgets. Harder to use...
Read more >
4. Render Custom Component in Material Table || Material UI
Render Custom Component in Material Table || Material UIHey Guys, in this video we will see how to render custom component and do ......
Read more >
Custom Dining Table Rendering
Custom Dining Table Rendering. Photo-2016-01-08-5-03-27-PM-2-3.jpg. Photo-2016-01-08-5-03-27-PM-. Custom Dining Table Rendering. Request a quote online.
Read more >
TYPO3 - Custom Table Rendering - Electric Retina
The TYPO3 CMS is extremely powerful and infinitely configurable and customizable. These are great features in a CMS when your client asks ...
Read more >
Custom table rendering — DataTables forums
Is it possible or smart to render data as pads or buttons - ie something other than a table using the editor /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found