【问题标题】:how to do autocomplete in angular 7 smart table with dynamic data?如何使用动态数据在 Angular 7 智能表中自动完成?
【发布时间】:2019-01-07 01:52:35
【问题描述】:

当我尝试在智能表中编辑/创建数据时,如何自动填充单元格中的数据。我尝试使用完成程序,但它没有显示任何结果。

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',
            },
          },
        }
      },
}
}

【问题讨论】:

    标签: angular7 ng2-smart-table


    【解决方案1】:

    这就是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. 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-17
      • 2019-02-05
      • 2018-11-12
      • 2020-11-27
      • 2017-09-09
      • 2011-06-02
      • 1970-01-01
      相关资源
      最近更新 更多