0
https://github.com/akveo/ng2-smart-table 在設置對象中,我們定義結構來顯示字段如名稱,標題等。我想直接將對象分配給列。 對象包含字段如何在ng2智能表中推送自定義數組對象
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服務調用獲取數組的情況下。