Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
How to generate row numbers (1, 2, 3, ...) when bind the custom table to array?

We have Vue.js project with custom table bound to array. It looks as following:

enter image description here

The key part of HTML code looks as following:

<InfiniteScroll ref="scroller" :disable="finished" @load="onLoad">
  <swipeable-table
    v-if="waitingList.length"
    :headers="headers"
    :items="waitingList"
    :loading="loading"
    custom-width
    outerBorder
  >
    <template slot="rows" slot-scope="{ item: booking }">
      <tr>
        <td>{{ 0 }}</td>
        <td></td>
        <td></td>
        <td>{{ fullName(booking.user) }}</td>
        <td>{{ unitName(booking.search_by) }}</td>
        ...
      </tr>
    </template>
  </swipeable-table>
  ...
</InfiniteScroll>

The waitingList is an array of objects.

The part of JavaScript code looks as following:

methods: {
  fullName(user) {
    return fullName.by(user, null, true)
  },
  unitName(unit) {
    return unit?.name ?? ''
  },
  ...

The table is scrollable that is it shows 30 items at the beginning and after you scroll next 30 items (30+30=60) and so on.

The array of objects looks as following:

enter image description here

enter image description here

Is there any way to use some JavaScript method to achieve it? If not how can I do it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can add index in the same way as item in template.

<template slot="rows" slot-scope="{ item: booking,index:index }">
  <tr>
    <td>{{ index }}</td>
    <td></td>
    <td></td>
    <td>{{ fullName(booking.user) }}</td>
    <td>{{ unitName(booking.search_by) }}</td>
    ...
  </tr>
</template>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!