showGridlines not working

UI Components for Vue
Post Reply
Harsh2207
Posts: 3
Joined: 06 Jun 2022, 21:09

06 Jun 2022, 21:22

Hey everyone,
I am trying to add different features to my table using the Datatable of Primevue, but am unable to do so.
My code is

Code: Select all

<template>
  <div class="tableView">
    <DataTable :value="data" showGridlines class="p-datatable-lg" responsiveLayout="scroll" >
    <Column v-for="col in columns" :field="col.field" :header="col.header" :key="col.field"></Column>
  </DataTable>
  <el-button type="warning" round @click="togtab">Toggle-Table</el-button>
</div>

  
</template>

 
<script>
import DataTable from '../../node_modules/primevue/datatable';
import Column from '../../node_modules/primevue/column';
import ColumnGroup from '../../node_modules/primevue/columngroup';     
import Row from '../../node_modules/primevue/row';  

export default {
  name: 'TableComp',
  props:['data'],
  data() {
      return {
        columns:[]
      };
    },
  components: {
    DataTable,
    Column
  },
  methods: {
 togtab(){
   for (let i=0; i< Object.keys(this.data).length ;i++ ){
      this.columns[i] = {field: Object.keys(this.data[0])[i], header: Object.keys(this.data[0])[i]}
    }
    console.log(this.columns)
 }  
}
}
</script>
In the output, I am just seeing a plain table without any gridlines or large size.
Am I importing the libraries incorrectly? What am I doing wrong?
I am new to primevue so any suggestions are appreciated.

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

08 Jun 2022, 08:39

Hello!

Which version are you using?

Harsh2207
Posts: 3
Joined: 06 Jun 2022, 21:09

08 Jun 2022, 18:07

tugce.kucukoglu wrote:
08 Jun 2022, 08:39
Hello!

Which version are you using?
Verison 3.13.1
I installed it according to the instruction given on the website https://www.primefaces.org/primevue/setup
And I am using Vue3

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

09 Jun 2022, 08:25

Could you please check this example? https://codesandbox.io/s/uqglfz

Harsh2207
Posts: 3
Joined: 06 Jun 2022, 21:09

10 Jun 2022, 19:34

tugce.kucukoglu wrote:
09 Jun 2022, 08:25
Could you please check this example? https://codesandbox.io/s/uqglfz
That looks great. I am importing everything the same way, but the only difference is I am using TypeScript. Is that the reason mine doesn't work?

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

01 Jul 2022, 11:23

Please send us a codesandbox link. Without see the code we could not replicate the issue.

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests