https://github.com/akveo/ng2-smart-table 在设置对象中,我们定义结构来显示名称、标题等字段。我想直接将对象分配给列。对象包含字段
only.settings = {
editable: false,
mode: 'inline',
add: {
confirmCreate: true
},
edit: {
confirmSave: true,
},
actions: {
delete: false
},
columns: {
food: {
title: 'Food',
filter: false,
},
quantity: {
title: 'Quantity',
filter: false,
},
unit: {
title: 'Unit',
filter: false,
editor: {
type: 'list',
config: {
list: [
{ value: 'gm', title: 'gm' },
{ value: 'slice', title: 'slice' },
{ value: 'cup', title: 'cup' },
{ value: 'glass', title: 'glass' },
{ value: 'pcs', title: 'pcs' },
{ value: 'ml', title: 'ml' },
{ value: 'bowl', title: 'bowl' },
{ value: 'tbspn', title: 'tbspn' }
]
}
}
},
我必须创造
array =>units[]= { value: 'bowl', title: 'bowl' },{ value: 'tbspn', title: 'tbspn' }
想要分配 =>
列表:this.units
但它不工作。以防我通过 Web 服务调用获取数组。