Skip to content

Commit f08806d

Browse files
Use jquery datatables for results done and close #70
1 parent 39bcfd2 commit f08806d

1 file changed

Lines changed: 49 additions & 39 deletions

File tree

Views/EventRegistrationResult/EventRegistrationResults.cshtml

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
@using Telerik.Web.Mvc.UI
2-
@using System.Data
3-
@using BExIS.Modules.EMM.UI.Models;
1+
@using BExIS.Modules.EMM.UI.Models;
42

53
@model EventRegistrationResultModel
64

5+
@section scripts
6+
{
7+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css">
8+
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
9+
}
10+
711
@section Information
812
{
913
With this interface you get all registration from all open and closed events.
@@ -15,42 +19,43 @@
1519
{
1620
if (Model.UserHasRights)
1721
{
18-
19-
@(Html.Telerik().Grid(Model.Results)
20-
.Name("EventRegistrationResults")
21-
.Sortable()
22-
.ClientEvents(clientEvents => clientEvents
23-
.OnDataBound("onDataBound"))
24-
.Columns(columns =>
25-
{
26-
foreach (DataColumn dc in Model.Results.Columns)
27-
{
28-
string title;
29-
30-
if (dc.Caption == "")
31-
{
32-
title = dc.ColumnName;
33-
}
34-
else
35-
{
36-
title = dc.Caption;
37-
}
38-
39-
columns.Bound(dc.DataType, dc.ColumnName)
40-
.Title(title).Width(dc.ColumnName.Length * 3); // forced fixed column width to enable horizontal scrolling
41-
}
42-
}
43-
44-
)
45-
)
46-
47-
@Html.ActionLink("Export (csv)", "Export", "EventRegistrationResult", new { id = Model.EventId }, new { @class = "bx-button function" })
48-
<span class="bx-button function" id="" onclick="Delete(@Model.EventId)" title="Delete event">Delete</span>
49-
}
50-
else
51-
{
52-
<p>You have no rights to this event.</p>
53-
}
22+
<table id="regResults">
23+
<thead>
24+
<tr>
25+
@for (int c = 0; c < Model.Results.Columns.Count; c++)
26+
{
27+
<th>
28+
@Model.Results.Columns[c].ColumnName
29+
</th>
30+
}
31+
</tr>
32+
</thead>
33+
<tbody>
34+
@for (int i = 0; i < Model.Results.Rows.Count; i++)
35+
{
36+
<tr>
37+
@for (int c = 0; c < Model.Results.Columns.Count; c++)
38+
{
39+
<td>
40+
@Model.Results.Rows[i][c].ToString()
41+
</td>
42+
43+
}
44+
</tr>
45+
}
46+
47+
</tbody>
48+
</table>
49+
50+
51+
52+
@Html.ActionLink("Export (csv)", "Export", "EventRegistrationResult", new { id = Model.EventId }, new { @class = "bx-button function" })
53+
<span class="bx-button function" id="" onclick="Delete(@Model.EventId)" title="Delete event">Delete</span>
54+
}
55+
else
56+
{
57+
<p>You have no rights to this event.</p>
58+
}
5459
}
5560

5661

@@ -65,6 +70,11 @@ else
6570

6671
<script type="text/javascript">
6772
73+
$(document).ready(function () {
74+
$('#regResults').DataTable();
75+
});
76+
77+
6878
function onDataBound() {
6979
addTooltips();
7080
}

0 commit comments

Comments
 (0)