我在我的 Angular 项目中使用 ng2-smart-table,它按预期工作。我只想知道如何在每一行中显示行号。从 google 上的文档和示例中,我能想到的只是在数据 itslef 中设置一个属性,这不是一个好主意。如果有任何方法或解决方法,请提出建议。这是我的 ng2-smart-table 的数据设置和样本数据
settings2 = {
columns: {
id: {
title: 'ID',
filter: true,
},
name: {
title: 'Fact',
filter: true,
},
description: {
title: 'Description',
filter: true,
},
},
actions: {
add: false,
edit: false,
delete: false,
custom: [
{
name: 'view',
title: `<i class="ti-eye text-success m-r-10" data-target="#view"></i>`,
},
{
name: 'edit',
title: `<i class="ti-pencil text-info m-r-10" data-target="#update"></i>`,
},
{
name: 'delete',
title: `<i class="ti-trash text-danger m-r-10"></i>`
},
]
}
}
数据 -
[{
"id": "770e6370-cf14-4a0a-b9db-0a6e99b5783b" ,
"list": [
{
"description": "Coopentity" ,
"type": "CO_OP"
} ,
{
"description": "" ,
"type": "FARM"
} ,
{
"description": "" ,
"type": "FACTORY"
} ,
{
"description": "" ,
"type": "AUDITING_FIRM"
}
] ,
"name": "entity_types"
}]
HTML -
<ng2-smart-table [settings]="settings2" [source]="facts" (custom)="onCustom($event)" class=""></ng2-smart-table>