首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ngx-datatable rowIndex从0开始

ngx-datatable rowIndex从0开始
EN

Stack Overflow用户
提问于 2019-11-06 18:14:44
回答 1查看 1K关注 0票数 0

ngx-datatable rowIndex从0开始

当我使用ngx-datatable rowIndex从0开始显示列表时,我们可以让它从1开始吗?

代码语言:javascript
复制
<ngx-datatable
    #table
    class="bootstrap table table-bordered"
    [columns] = "columns"
    [columnMode]="'force'"
    [headerHeight]="50"
    [footerHeight]="35"
    [rowHeight]="'auto'"
    [limit]="listLimit"
    [rows]="tutors">

  <ngx-datatable-column name="S No.">
    <ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-row="row">
      {{rowIndex}}
    </ng-template>
  </ngx-datatable-column>

</ngx-datatable>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-11-06 18:18:10

ngx-datatable rowindex从0开始。在显示时,您可以在html中将rowindex递增1。

请参考下面的代码。

代码语言:javascript
复制
<ngx-datatable
    #table
    class="bootstrap table table-bordered"
    [columns] = "columns"
    [columnMode]="'force'"
    [headerHeight]="50"
    [footerHeight]="35"
    [rowHeight]="'auto'"
    [limit]="listLimit"
    [rows]="tutors">

  <ngx-datatable-column name="S No.">
    <ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-row="row">
      {{rowIndex+1}}
    </ng-template>
  </ngx-datatable-column>

</ngx-datatable>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58727754

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档