valor-software / ng2-table

Simple table extension with sorting, filtering, paging... for Angular2 apps
http://valor-software.github.io/ng2-table/
MIT License
553 stars 336 forks source link

angular2 datatables are not working for dynamic data but working fine for static data #609

Open Kushmajum801435 opened 5 years ago

Kushmajum801435 commented 5 years ago

I'm new in angular2 and I'm trying to structure my data in a data table format. so far it worked fine for static data like when the rows are already present in the html but i need it for data coming dynamically from my backend which is not working and all are coming in one page at the same time.

HamedBagheri1992 commented 5 years ago
ngOnInit() {          
   let param=new DataFilter();
   param.pageNumber=this.page;
   param.pageSize=this.itemsPerPage;
this.dataService.GetAllData(param).subscribe(res=>{      
  this.data=res.data;      
  this.length = res.totalItems;      
  this.numPages=res.totalPage;
  this.rows = this.data;     
});  

}