我正在尝试在页面上使用columnfilter。在一个页面上,此过滤工作正在进行,但在此页面上却没有。我尝试从可用的页面中处理相同的脚本URL,我尝试从脚本列表拖到页面上但仍然没有。
注意:该页面包含搜索页眉和页脚字段,当我将搜索文本放入时它会响应,但它不会返回任何内容。我得到:“每次显示0个条目中的0到0(从10个条目中过滤掉)”......
我可能做错了什么或丢失了什么?感谢您对这个>
的任何帮助 <link href="../../Content/dataTable/the_table.css" rel="Stylesheet" type="text/css" />
<script src="../../Scripts/DataTables-1.9.1/media/js/jquery.dataTables.js" type ="text/javascript"></script>
<script src="../../Scripts/jquery.dataTables.columnFilter.js" type ="text/javascript"></script>
<script src="../../Scripts/jquery.ui.datepicker.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".datefield").datepicker();
$("#history").dataTable().focus().columnFilter({
aoColumns: [null, { type: "text" },null , null, null, null]
});
});
</script>
<br /><br />
@Html.ActionLink("Select", "ClassAttendance", "Attendance", new { rows = Model.Enrollments.Count(), id = @ViewBag.ID, teacher = HttpContext.Current.Session["sTeacher"], courseID = HttpContext.Current.Session["sCourseID"] }, null)
<p></p>
@using (Html.BeginForm("ClassAttendance", "Attendance", new { rows = Model.Enrollments.Count(), id = @ViewBag.ID, sTeacher = @ViewBag.teacherName, courseID = HttpContext.Current.Session["sCourseID"] }, FormMethod.Post))
{
var attend = new Enrollment();
@Html.ValidationSummary(true)
<p></p>
<h3>Students Enrolled in @ViewBag.teacherName's @ViewBag.courseTitle class</h3>
<div>
<table id=history>
<thead>
<tr>
<th>Reports</th>
<th>First Name</th>
<th>Last Name</th>
<th>Grade</th>
<th>Attendance Code</th>
<th>Class Day</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Reports</td>
<td>First Name</td>
<td>Last Name</td>
<td>Grade</td>
<td>Attendance Code</td>
<td>Class Day</td>
</tr>
</tfoot>
<tbody>
@foreach (var item in Model.Enrollments)
{
@Html.HiddenFor(modelItem => item.EnrID)
@Html.HiddenFor(modelItem => item.Asgnt)<!--navigational-->
@Html.HiddenFor(modelItem => item. Title)
@Html.HiddenFor(modelItem => item.CouID)
@Html.HiddenFor(modelItem => item.Date)
@Html.HiddenFor(modelItem => item.dayOfWeek)
@Html.HiddenFor(modelItem => item.Actor)
@Html.HiddenFor(modelItem => item.SudIDD)
@Html.HiddenFor(modelItem => item. Address)
<tr>
<td>
@Html.ActionLink("Report", "PrintCustomers", "PdfRender", new { sName = item.Student.FirstMidName, courseTitle = item.Course.Title, sNumber = item.Student.StudentNum, instructorName = HttpContext.Current.Session["teacherName"] }, null)
</td>
<td>
@Html.EditorFor(modelItem => item.Student.FirstMidName)
</td>
<td>
@Html.EditorFor(modelItem => item.Student.LastName)
</td>
<td>
@Html.TextBoxFor(modelItem => item.HomeworkGrade)
@Html.ValidationMessageFor(model => model.Enrollments.FirstOrDefault().HomeworkGrade)
</td>
<td>
@Html.TextBoxFor(modelItem => item.attendanceCode)
@Html.ValidationMessageFor(model => model.Enrollments.FirstOrDefault().attendanceCode)
</td>
<td>
@Html.EditorFor(modelItem => item.classDays)
</td>
</tr>
}
</tbody>
</table>
</div>
<br />
<Input Type ="submit" Value="Submit Attendance"/>
}
答案 0 :(得分:0)
我不确定这是否会导致您所描述的问题但是您的表格ID未被引用。
<table id=history>
应为<table id="history">
答案 1 :(得分:0)
我终于通过脚手架而不是复制一个视图的功能,粘贴到另一个视图并进行调整来重新创建视图。我怀疑它可能与没有值的导航属性或仅在视图中具有导航属性有关。请让我知道你在想什么。感谢。