0

我正在尝试在页面上使用 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"/>
  }
4

2 回答 2

0

我不确定这是否会导致您描述的问题,但您的表 ID 没有被引用。

<table id=history>

应该<table id="history">

于 2013-02-25T00:32:48.583 回答
0

I finally recreated the view by having it scaffolded rather than copying the functionality of one view, pasting into another and tweaking. I suspect it may have had something to do with navigational properties not having values or simply having navigational properties in the view. Please let me know what you think. Thanks.

于 2013-02-27T07:13:49.263 回答