I need to know the correct practice to use in this scenario:
I have a WebApi that returns a tabular dataset and I have to show it using bootstrap tables...
How to implement it? Which bootstrap component should I use?
The table is very simple, it expose just few data and a button to go in the row detail...
The mat-table provides a Material Design styled data-table that can be used to display rows of data. This table builds on the foundation of the CDK data-table and uses a similar interface for its data input and template, except that its element and attribute selectors will be prefixed with mat- instead of cdk- .
MatTableDataSource. Data source that accepts a client-side data array and includes native support of filtering, sorting (using MatSort), and pagination (using MatPaginator). Allows for sort customization by overriding sortingDataAccessor, which defines how data properties are accessed.
What is Angular DataTables? Angular DataTables is a library for building complex HTML tables that uses jQuery's DataTables plugin. It is configured to support TypeScript and optimized for Angular 2+. Angular DataTables will come in handy when: You have a very large dataset coming in from one or more API endpoints.
Here's an example of simple table that will redirect you to details on row click:
<table class="table table-hover">
<thead>
<tr>
<td>Id</td>
<td>Title</td>
<td>Amount</td>
</tr>
</thead>
<tbody>
<tr *ngFor="let transfer of transfers" [routerLink]="['/transfer']" [queryParams]="{ id: transfer.id }">
<td>{{transfer.id}}</td>
<td>{{transfer.title}}</td>
<td>{{transfer.amount}}</td>
</tr>
</tbody>
</table>
I assumed you're working with transfers
array and redirect based on id
.
You can use Bootstrap angular 2 data tables. check this URL
If you like to test another solution go with teradata covalent data table. Check this link
By using you can get responsive design with some more additional features such as: search facility, Pagination
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With