【发布时间】:2015-07-06 18:51:51
【问题描述】:
我一直在尝试在单击时对表数据进行排序(如果我使用 angularJS,则单击 ng-click) 我正在从数据库中获取数据。我只需要排序功能,如果它通过 angularJs 发生,我会很高兴
这就是我到现在为止所做的,因为我是 AngularJS 的新手,所以我没有做太多
@model WebApplication3.Models.StudentModel
@{
ViewBag.Title = "Index";
}
<h2>Students</h2>
<div><button class="create btn btn-success"><span class="glyphicon glyphicon-plus"></span> Create New</button></div>
<br/>
<table class="table" ng-app="StudentApp">
<tbody ng-controller="StudentCtrl">
<tr>
<th>Key</th>
<th ng-click="">First Name</th>
<th ng-click="">Last Name</th>
<th>Profile picture</th>
<th>Options</th>
</tr>
@foreach (var student in Model._StudentList)
{
<tr>
<td>@student.StudentID</td>
<td>@student.FirstName</td>
<td>@student.LastName</td>
<td>
<a class="example-image-link" href="~/Images/@student.PhotoURL" data-lightbox="example-set" data-title="@student.FirstName @student.LastName profile Picture"><img class="example-image" width="60" height="40" src="~/Images/@student.PhotoURL" alt="" /></a>
</td>
<td>
<a href="#" class="edit" data-studentid="@student.StudentID"><span class="glyphicon glyphicon-pencil img-rotate" title="Edit"></span></a>
<a href="#" class="details" data-studentid="@student.StudentID"><span class="glyphicon glyphicon-exclamation-sign img-rotate" title="Infomation"></span></a>
<a href="#" class="delete" data-studentid="@student.StudentID"><span class="glyphicon glyphicon-remove img-rotate" title="Remove"></span></a>
</td>
</tr>
}
</tbody>
</table>
当他们点击相应的标签时,我需要对名字、姓氏进行排序
谢谢
【问题讨论】:
标签: asp.net-mvc angularjs html