@page "/"
@if ((definitions == null) || (!definitions.Any()))
{
<p>Loading Definitions...</p>
}
else
{
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Parameters</th>
<th>Created</th>
<th>Modified</th>
</tr>
</thead>
<tbody>
@foreach(var def in definitions)
{
<tr>
<td>@def.Name</td>
<td class="description-cell"><div class="ellipsis">@def.Description</div></td>
<td>@def.Parameters</td>
<td>@def.CreatedOnUtc</td>
<td>@def.ModifiedOnUtc</td>
</tr>
}
</tbody>
</table>
}
@code{
List<def> definitions = new List<def>();
protected override void OnInitialized(){
definitions.Add(new def{ Name="Name 1", Description="now is the time for all good men to come to the aide of their party, now is the time for all good men to come to the aide of their party, now is the time for all good men to come to the aide of their party"});
definitions.Add(new def{ Name="Name 2", Description="The quick brown fox jumped over the lazy dog"});
}
public class def{
public string Name{get;set;}
public string Description {get;set;}
public string Parameters {get;set;}
public string CreatedOnUtc {get;set;}
public string ModifiedOnUtc {get;set;}
}
}
<style>
td.description-cell {
max-width: 15em;
}
div.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>