I'm building a Blazor app, which has a table with about 20 columns. Once data is loaded you have to scroll sideways, which is less than optimal.
Is there a better way of displaying the data?
In a UWP app I had the layout like the image below:
Is there a way to display data like this image in a HTML table?
The table layout I have for the Blazor app is:
<table class="table">
<thead>
<tr>
<td><b>Shipment type</b></td>
<td><b>Carrier</b></td>
<td><b>Country of departure</b></td>
<td><b>Shipping Company</b></td>
<td><b>Goods description</b></td>
<td><b>Weight or Volume</b></td>
<td><b>Package status</b></td>
<td><b>Actions</b></td>
<td><b>Package file number</b></td>
<td><b>AWB Number</b></td>
<td><b>Manifest number</b></td>
<td><b>Package number</b></td>
<td><b>Package type</b></td>
<td><b>Value</b></td>
<td><b>Date in</b></td>
<td><b>Date stripped</b></td>
<td><b>ETS number</b></td>
<td><b>Shipping method</b></td>
<td><b>Receiver</b></td>
<td><b>Quantity</b></td>
<td><b>Customer</b></td>
<td><b>Date out</b></td>
</tr>
</thead>
<tbody>
<tr>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>
<a href="#">Edit</a> | <a href="#">Delete</a>
</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
<td>xxx</td>
</tr>
</tbody>
</table>
Any help is appreciated.
As mentioned in my comment, I'd contemplate ditching the
table
all together. You should only use the thetable
tag when you have tabular data, but just because you have tabular data doesn't mean you have to use it. If you want to display as a list of items for layout reasons go for it.Moving away from a table can give you more flexibility and easier control with media queries than a table.
In the example below, I've use and ordered list of items. Each item then contains a CSS grid to layout the data. The example is a bit rough and ready but should give you something to work with if you want to move away from the rigidity of tables