Is there a way to switch up the column headers in this data table?

 <b-table class="table"
  show-empty
  small
  stacked="md"
  :items="items"
  :fields="fields"
  :current-page="currentPage"
  :per-page="perPage"
  :filter="filter"
  :filterIncludedFields="filterOn"
  :sort-by.sync="sortBy"
  :sort-desc.sync="sortDesc"
  :sort-direction="sortDirection"
  @filtered="onFiltered"
  >

  <template v-slot:cell(name)="row">
    {{ row.value.first }} {{ row.value.last }}
  </template>
   <template v-slot:row-details="row">
    <b-card>
      <ul>
        <li v-for="(value, key) in row.item" :key="key">{{ key }}: {{ value }}</li>
      </ul>
    </b-card>
  </template>
</b-table>

Displaying the array data :

 data() {
  return {
    items: [
      { Store: 'alex',  snapshot: 'missing'},
      { Store: 'jjj', snapshot: 'hadara', store: 'store 1', class: 'A', missing: 'missing'},
      { Store: 'tyui', retail: 'hadara', store: 'store 1', class: 'A', missing: 'missing'},
      { Store: 'ttt', retail: 'hadara', store: 'store 1', class: 'A', missing: 'missing'},
      { Store: 'mmm', retail: 'hadara', store: 'store 1', class: 'A', missing: 'missing'},
      { Store: 'zzz', retail: 'hadara', store: 'store 1', class: 'A', missing: 'missing'},
      { Store: 'aaaaa', retail: 'hadara', store: 'store 1', class: 'A', missing: 'missing'},
    ],

The table displays store and snapshot as headers to the data above. If you want to change this header with static data or customize it using an API, what steps should be taken?

Answer №1

You added Store and snapshot to the items.

Please correct it by referring to the code below.

Fingers crossed that it will work!

data() {
  return {
    items: [
      { Store: 'alex',  snapshot: 'found'},  
      { Store: 'jjj', snapshot: 'hadara', store: 'store 1', class: 'A',  missing: 'missing'},
      { Store: 'tyui', retail: 'hadara', store: 'store 1', class: 'A',  missing: 'missing'},
      { Store: 'ttt', retail: 'hadara', store: 'store 1', class: 'A',  missing: 'missing'},
      { Store: 'mmm', retail: 'hadara', store: 'store 1', class: 'A',  missing: 'missing'},
      { Store: 'zzz', retail: 'hadara', store: 'store 1', class: 'A',  missing: 'missing'},
      { Store: 'aaaaa', retail: 'hadara', store: 'store 1', class: 'A',  missing: 'missing'},
    ],

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Avoid Reselecting Dropdown Choices in PowerApps Model-Driven Apps

Currently, I am working on a PowerApps project that involves multiple dropdown lists (option sets) where users should only be able to select each team once. I am striving to prevent users from reselecting teams that have already been chosen but facing some ...

Navigating through URLs in Angular.js using html5Mode enabled

I am trying to implement accessible and bookmarkable URLs that are routed by angular.js. This application can be accessed through a specific part of the website at http://example.com/application/ Anything that comes after /application/ is considered a ro ...

"When attempting to pass a string into the res.send() method in Node.js, undefined

As a new Node.js user, I'm attempting to send data back to the browser by utilizing a function called load_blocks() from an external file that I created, and then calling it with res.send(). I currently have two basic files in my setup: The first on ...

What is the best way to determine if a user has closed the window/browser or powered off their computer?

I'm looking for a way to determine if users are still active on my webpage rather than just checking if they have left. I am unsure of how to approach this issue and would appreciate any guidance. Your assistance is greatly appreciated. ...

The error message "Property '$store' is not defined on type 'ComponentPublicInstance' when using Vuex 4 with TypeScript" indicates that the property '$store' is not recognized

I'm currently working on a project that involves using TypeScript and Vue with Vuex. I've encountered an error in VSCode that says: Property '$store' does not exist on type 'ComponentPublicInstance<{}, {}, {}, { errors(): any; } ...

Shifting the final child to the front position proves unsuccessful with jQuery

I have attempted to move the last element in my list to the first position upon clicking, but unfortunately, it is not working as expected. I followed the advice provided in response to a question on the following page: Move last child to first position. W ...

$.ajax causing a JSON input string malfunction

My web API requires the following JSON format for input: [{ "atrSpaUserId": "47fe8af8-0435-401e-9ac2-1586c8d169fe", "atrSpaClassLegendId": "00D18EECC47E7DF44200011302", "atrSpaCityDistrictId": "144d0d78-c8eb-48a7-9afb-fceddd55622c"}, { "atrSpaUserId": "47 ...

React - Uncaught Error: e.preventDefault is not a function due to Type Error

Encountering an issue with Axios post and react-hook-form: Unhandled Rejection (TypeError): e.preventDefault is not a function The error arises after adding onSubmit={handleSubmit(handleSubmitAxios)} to my <form>. Seeking to utilize react-hook-form ...

The component encountered an error because the element type provided was not valid

I've encountered an error that has me stumped: https://i.sstatic.net/glSvr.png I've been trying to locate the HeaderSegment, but it seems to be missing from my project. I've checked for any imports, such as: import HeaderSegment from &apos ...

The popup is unable to remain in the center of the screen because the background page keeps scrolling back to the top

Whenever I click a button to open a popup window, the page unexpectedly scrolls to the top. It's frustrating because if I'm at the bottom of the page and press the 'submit' button, the popup doesn't display in the center as intende ...

Struggling with AngularJs as I attempt to retrieve my Twitter timeline. It's been a challenge

Currently, I am using the code below to fetch tweets for a timeline. This snippet was originally taken from an AngularJS tutorial and worked perfectly with Twitter's search API. angular.module( 'Twitter', [ 'ngResource' ]); func ...

Retrieving the ID and value of a specific dropdown list using jQuery from an array of dropdown lists

My HTML structure looks like this: <?php foreach($active_brand as $brand) { ?> <select name="selector" id="selector"> <?php foreach($options as $option) { ?> <option <?php if($brand['State'] == $option) { ?& ...

Conceal and reveal content using the caret class

I want to create a feature where a portion of text is displayed from a description field, and then expand to show the full text when a caret icon is clicked. This is my current implementation, which is very close to what I envision: <div class="card-b ...

The npm copy script is not functioning properly on the Windows 8.1 operating system

I am working on a sapui5 project and I need to execute the following npm script from my package.json: "scripts": { "flatten": "copy -r \\dist\\resources\\test\\commonjslib\\* dis ...

Generate a stylish word cloud using a PHP array

I'm having trouble getting the jQCloud utility to create a word cloud for me. Here is the code from my controller: public function consultar(Request $request) { $entidad = $request['entidad']; $result = exec("python3 /root/TFGArchivos/Scri ...

Jest is unable to handle SVG files when they are imported with an argument

Using @nuxtjs/svg with "vue-svg-loader" mode means importing SVGs like this: import ArrowRight from '~/assets/img/arrow-right.svg?inline' However, Jest encounters a problem with the "?inline" part: Could not find module ~/assets/img/arrow-right. ...

Troubleshooting EJS Relative Path Problem when Using "include" in an HTML Document

I'm encountering an issue with my "index.ejs" file... The current content of the ejs file: <!DOCTYPE html> <html lang="en" dir="ltr"> <!-- THIS SECTION IS FOR <head> TAG THAT WILL BE STORED INSIDE "so_ ...

Is there a way to dynamically include an attribute using VueJS?

Is there a way in Vue to dynamically add an attribute, not just the value of an attribute using v-bind? I am aware that I can set a value to an attribute dynamically with v-bind, but I would like to add the attribute itself based on a condition. Something ...

Exploring JSON data through key-value pairs

When faced with a de-serialized JSON object that has an arbitrary structure and mixed value types... var data = { 'a':'A1', 'b':'B1', 'c': [ {'a':'A2', 'b':true}, ...

Issues with tooltipTemplate functionality within Chart.js

I've been experimenting with a bar graph in Chart.js, and I'm attempting to implement custom tooltips. After doing some research, it appears that adding tooltipTemplate: "<%= value %>% test" to my options section should append the word & ...