Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill data using *ngFor in Angular 4 problem #286

Open
OmkarJadhav21 opened this issue Jul 24, 2018 · 2 comments
Open

Fill data using *ngFor in Angular 4 problem #286

OmkarJadhav21 opened this issue Jul 24, 2018 · 2 comments

Comments

@OmkarJadhav21
Copy link

I am using angular 4 for for developement but when data is inserted into the rows ,pagination and total no.of entries will not be shown please refer the below code to solve the issue.I am attaching thne screenshot of issue please suggest the best solutions in angular 2/4/6 only

**JSON

contentData:[
{ 
  firstName:'xyz',
  lastname:'abc',
  mobileNumber:'9999999999'
},
{ 
  firstName:'xyz',
  lastname:'abc',
  mobileNumber:'9999999999'
},
{ 
  firstName:'xyz',
  lastname:'abc',
  mobileNumber:'9999999999'
}
]

HTML


<tbody>
 <tr *ngFor="let row of dataTable.dataRows">
    <td >{{row.firstName}}
       <div class="positiondown">{{row.lastname}}</div>
    </td>
    <td >
       <div class="positiondown">{{row.mobileNumber}}</div>
    </td>
 </tr>
</tbody>

TYPESCRIPT

ngOnInit() {
  this.dataTable = {
    headerRow: ['Name','Add'],
    dataRows: [  ],
  };
 this.datatable.dataRows = JSON.contentData;   // DATA IN ABOVE JSON

 ngAfterViewInit() {
    $('#datatables').DataTable({
      'pagingType': 'full_numbers',
      'lengthMenu': [[10, 25, 50, -1], [10, 25, 50, 'All']],
      responsive: true,
      paging: true,
      ordering: false,
      language: {
        search: '_INPUT_',
        searchPlaceholder: 'Search records',
      }
    });
}
}

issue

I also tried with --
setTimeout(function () { this.initTable(); }, 10);

@chelaruc
Copy link
Contributor

@OmkarJadhav21 thank you for using our product and sorry for the late response. Check #33 and tell me if you'll find the solution here. Best, Ciprian

@OmkarJadhav21
Copy link
Author

I already tried with #33 but it can't solve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants