【发布时间】:2021-10-05 19:47:20
【问题描述】:
我有[value]="rows[indexString]" 用于模板中的数据表。
在组件中
rows: any = {}
newrow: any = {}
...
addNewRow(key: string) {
let rows = {...this.rows}
let newrow = {_key: Math.floor(Math.random() * 10000), title: this.newrow.title}
if (rows[key]) {
rows[key].push(newrow)
} else {
rows[key] = newrow
}
this.rows = rows
}
基本上我正在学习here的教程
只有第一行呈现在表格中,在模板{{rows | json}}中,一切都在那里:
{
"210386": [
{
"_key": 9173,
"title": "Row one"
},
{
"_key": 6201,
"title": "Row Two"
}
]
}
【问题讨论】:
标签: angular typescript datatable primeng