当我试图在智能表中编辑/创建数据时,如何自动填充单元格中的数据。我尝试使用完成器,但它没有显示任何结果。
export const dataTable = [];
export const dataTablesettings ={
hideheaders: true,
actions: {
add:true,
edit:true,
delete:true,
columnTitle: 'Actions',
},
noDataMessage: 'No data found',
columns: {
ItemCode: {
title: 'Code',
type: 'string',
filter: true,
editable: true,
editor: {
type: 'completer',
config: {
completer: {
data: dataTable,
searchFields: 'ItemCode',
titleField: 'ItemCode',
},
},
}
},
}
}发布于 2019-01-07 01:52:35
这就是ng2-smart-table的魔力。它的主要优点是当你想要使用内联编辑功能编辑数据时,可以填充数据。
在编辑时,ng2-smart-table的默认功能是填充行数据。如果您无法显示数据,这意味着您缺少了一些东西。
在创建时,当您单击保存按钮时,您已经使用了它(onCreate)="saveData(event)"方法。
在.ts文件中
saveData(event){
event.confirm.resolve(); // This will add new data on top of the data.
}https://stackoverflow.com/questions/54052330
复制相似问题