0

when i'm trying to edit/create data in smart table how to auto fill the data in the cell. I tried with completer but it is showing me no results.

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',
            },
          },
        }
      },
}
}
Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72

1 Answers1

0

That is the magic of ng2-smart-table. The main advantage of that is the filled data when you want to edit data with inline edit feature.

While edit, It is the default feature of ng2-smart-table is to fill row's data. If you are unable to show data that mean you are missing something.

In a matter of create, When you clicked on save button you have use it's (onCreate)="saveData(event)" method.

In .ts file

saveData(event){
    event.confirm.resolve(); // This will add new data on top of the data. 
}
Sachin Shah
  • 4,503
  • 3
  • 23
  • 50