Id | Name | Surname | Marital status | Age | Birthday | Employed |
---|---|---|---|---|---|---|
1 | Joe | Crosswave | Married | 32 | 1/5/1993 | False |
2 | Merry | Lisel | Widowed | 41 | 5/6/1983 | |
3 | Henry | Crux | Single | 29 | 11/19/1995 | True |
4 | Cody | Jurut | 49 | 8/11/1975 | False | |
5 | Simon | Scranton | Single | 34 | 10/10/1990 | |
6 | Leena | Laurent | Divorced | 19 | 7/1/2005 | False |
7 | Ode | Cosmides | Married | 53 | 4/17/1971 | True |
8 | Diandra | Mizner | Single | 20 | 8/20/2004 | False |
9 | Pete | Cassel | Married | 22 | 3/13/2002 | False |
10 | Nicky | Tremblay | Married | 32 | 1/5/1993 | True |
11 | Mary | Cassel | Married | 24 | 7/10/2000 | True |
@model IQueryable<Person>
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(model => model.Id).Css("collapse");
columns.Add(model => model.Name).Titled("Name");
columns.Add(model => model.Surname).Titled("Surname");
columns.Add(model => model.MaritalStatus).Titled("Marital status");
columns.Add(model => model.Age).Titled("Age").Css("text-right");
columns.Add(model => model.Birthday).Titled("Birthday").Formatted("{0:d}");
columns.Add(model => model.IsWorking).Titled("Employed");
})
.Id("my-grid")
.Css("css-classes")
.AppendCss("table-hover")
.Attributed(new { data_type = "individuals" })
.RowAttributed(model => new { @class = model.IsWorking == true ? "working" : null, data_id = model.Id })
)
<div id="my-grid" class="mvc-grid mvc-grid-excel-mode">
<table class="css-classes table-hover" data-type="individuals">
...
<tbody>
...
<tr data-id="2">...</tr>
...
...
<tr data-id="5">...</tr>
...
<tr class="working" data-id="7">
...
<td class="text-right">53</td>
...
</tr>
...
</tbody>
...
</table>
</div>