ng2-smart-table display list of object

1.7k Views Asked by At

Is there a way to display a list of objects in a single table cell for ng2-smart-table? I have tried creating a renderComponent but I am getting an empty value. Another question is will the filtering and sorting still work for this?

Object that I want to dislay

enter image description here

enter image description here

1

There are 1 best solutions below

10
On

As I understood , You have a object and you want to display that data in ng2-smart-table.

For that follow this step.

import { LocalDataSource } from 'ng2-smart-table';

source : any =  LocalDataSource;

When you call API then you have to set that data in source.

this.apiService.POST({}, 'getProductList').subscribe((res) => {      
  console.log(res);                  
  this.source = new LocalDataSource(res.data);  // Set response as per your res.             
});

Data in table

As you can see I have also set one array and that array has objects of data and I have set in table.

I hope this may help you. :)