uwla / vue-data-table

Vue data table plugin
https://uwla.github.io/vue-data-table/demo
130 stars 23 forks source link

Possible add Line number ? #72

Closed bombkiml closed 1 year ago

bombkiml commented 1 year ago

I want to add Line number of # column Please help. It's possible ?

===========================
|   #    |       Name     |
---------------------------
|   1    |     Jane       |   
|   2    |     Jones      |  
|   3    |     John       |   
|   .    |     Jack       | 
|   .    |     jame       | 
|   .    |      ...       | 
uwla commented 1 year ago

Hello, thanks for the question.

Yes, it is quite easy:

<template>
  <data-table v-bind="tableProps"/>
</template>
<script>

let mydata = [
  { name: "joe" },
  { name: "any" },
  /* */
]
mydata.forEach((item, i) => item.index = i+1);

export default {
  /* ... some code */
  data() {
    return {
      tableProps: {
        columnns: [
          { key: 'index', title: '#' },
          { key: 'name'}
        ],
        data: mydata,
      }
    }
  }
}
</script>

sorry for the late reply ive been busy

bombkiml commented 1 year ago

Great, Thank you so much @AndreSouzaAbreu