I am using Asp.net MVC4 . I have Razor Index View with HTML5 Table.
Now asked to add dynamic (user) grouping functionality to the existing table. Please suggest me / refer me how can I implement with Jquery and HTML5 plain.
So I can't use any jqgrid , datatable or any other frameworks.
Example : Allow User to Group by any column -> Department / JobType or both
CSHTML
@model IEnumerable<EmployeeViewModel>
@{
ViewBag.Title = "Employees";
}
<h2>Employees</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.MiddleName)
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.FullName)
</th>
<th>
@Html.DisplayNameFor(model => model.EmployeeNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.Department)
</th>
<th>
@Html.DisplayNameFor(model => model.JobType)
</th>
<th></th>
</tr>
@foreach(var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.MiddleName)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.EmployeeNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.Department)
</td>
<td>
@Html.DisplayFor(modelItem => item.JobType)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
@Html.ActionLink("Details", "Details", new { id = item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id })
</td>
</tr>
}
View Model
public class EmployeeViewModel
{
public int Id { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string JobType { get; set; }
public string Department { get; set; }
public string FullName
{
get
{
if (string.IsNullOrEmpty(MiddleName))
{
return FirstName + " " + LastName;
}
return FirstName + " " + MiddleName + " " + LastName;
}
}
public string EmployeeNumber { get; set; }
}
Thanks,
ineffable