Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. // cài đặt bảng
  2. $('#MainTable').DataTable({
  3. 'paging': true,
  4. 'lengthChange': true,
  5. 'searching': true,
  6. 'ordering': true,
  7. 'info': true,
  8. 'autoWidth': true,
  9. 'aoColumnDefs': [{
  10. 'bSortable': false,
  11. 'aTargets': ['nosort']
  12. }]
  13. });
  14.  
  15. ý nghĩa các thuộc tính
  16. - paging: phân trang
  17. - lengthChange: tự thay đổi độ dài của cột
  18. - searching: có ô search hay không
  19. - ordering: có auto sort hay không
  20. - info: cái này không biết
  21. - autoWidth: tự động chỉnh chiều rộng
  22. - aoColumnDefs: danh sách các định nghĩa riêng: cái cột có class = nosort => cột này không sort
  23.  
  24. // cài đặt bảng
  25. <table id="MainTable" class="table table-bordered table-hover">
  26. <thead>
  27. <tr>
  28. <th>No.</th>
  29. <th>@Html.DisplayNameFor(Model => Model.LeaveVMForDisplay.UserName)</th>
  30. <th>@Html.DisplayNameFor(Model => Model.LeaveVMForDisplay.LeaveType)</th>
  31. <th>@Html.DisplayNameFor(Model => Model.LeaveVMForDisplay.WorkShift)</th>
  32. <th>@Html.DisplayNameFor(Model => Model.LeaveVMForDisplay.FromDate)</th>
  33. <th>@Html.DisplayNameFor(Model => Model.LeaveVMForDisplay.ToDate)</th>
  34. <th class="table_align_center">@Html.DisplayNameFor(Model => Model.LeaveVMForDisplay.State)</th>
  35. <th name="LeaveID" hidden>LeaveID</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. @{
  40. int i = 1;
  41. foreach (var item in Model.LeaveVM)
  42. {
  43. <tr>
  44. <td>@i.ToString()</td>
  45. <td>@Html.DisplayFor(m => item.UserName)</td>
  46. <td>@Html.DisplayFor(m => item.LeaveType)</td>
  47. <td>@Html.DisplayFor(m => item.WorkShift)</td>
  48. <td>@Html.DisplayFor(m => item.FromDate)</td>
  49. <td>@Html.DisplayFor(m => item.ToDate)</td>
  50. @if (item.State == TSM.Data.Models.Leave.eState.OnQueue)
  51. {
  52. <td class="table_align_center"><label class="label label-warning">&nbsp;&nbsp;Waiting&nbsp;</label></td>
  53. }
  54. else
  55. {
  56. if (item.State == TSM.Data.Models.Leave.eState.Approved)
  57. {
  58. <td class="table_align_center"><label class="label label-success">Approved</label></td>
  59. }
  60. else
  61. {
  62. <td class="table_align_center"><label class="label label-danger">Rejected</label></td>
  63. }
  64. }
  65. <td hidden>@item.LeaveID</td>
  66. </tr>
  67. i++;
  68. }
  69. }
  70. </tbody>
  71. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement