Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm working on this right now. I'm using ASP.Net MVC 2 Web Application, using the dataTables religiously, and need to show over 1000 records on each table. Server-Side processing was the way to go for me. Here's what we have.</p> <p>Here's our declaration in the view (/Admin/Unassigned).</p> <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt; $(document).ready(function() { $('#adminUnassignedTable').dataTable({ "bProcessing": true, "bServerSide": true, "sAjaxSource": "/Admin/UnassignedTable" }); }); &lt;/script&gt; </code></pre> <p>Here's our controller function (/Admin/UnassignedTable).</p> <pre><code>public void UnassignedTable() { statusID = (int)PTA.Helpers.Constants.Queue; locationID = (int)PTA.Helpers.Constants.Reviewer; _AdminList = PTA.Models.IPBRepository.GetIPBsByStatus(Convert.ToInt32(statusID), Convert.ToInt32(locationID)); //_AdminList is an IEnumerable&lt;IPB&gt;, IPB being our class IEnumerable&lt;IPB&gt; _NewList; int nDisplayStart = Convert.ToInt32(HttpContext.Request.QueryString.Get("iDisplayStart"); int nDisplayLength = Convert.ToInt32(HttpContext.Request.QueryString.Get("iDisplayLength"); _NewList = _AdminList.Skip&lt;IPB&gt;(nDisplayStart).Take&lt;IPB&gt;(nDisplayLength).ToList&lt;IPB&gt;(); string strOutput = "{"; strOutput += "\"sEcho\":" + HttpContext.Request.QueryString.Get("sEcho") + ", "; strOutput += "\"iTotalRecords\":" + _AdminList.Count().ToString() + ", "; strOutput += "\"iTotalDisplayRecords\":" + _AdminList.Count().ToString() + ", "; strOutput += "\"aaData\":["; foreach (IPB ipb in _NewList) { strOutput += "[ "; strOutput += "\"" + ipb.IPBName + "\","; strOutput += "\"" + ipb.PubDate + "\","; strOutput += "\"" + ipb.Change + "\","; strOutput += "\"" + ipb.ChangeDate + "\","; strOutput += "\"" + ipb.TotalParts + "\","; strOutput += "\"" + ipb.TotalPartsReports + "\","; strOutput += "\"" + ipb.ALC + "\","; strOutput += "\"" + ipb.DateAdded + "\","; strOutput += "\"" + "" + "\","; //Need to add drop down control, that's why it's blank. strOutput += "\"" + "" + "\","; //Need to add drop down control, that's why it's blank. strOutput += "\"" + "" + "\","; //Need to add drop down control, that's why it's blank. strOutput += "\"" + "" + "\""; //Need to add drop down control, that's why it's blank. strOutput += "]"; if (ipb != _NewList.Last()) { strOutput += ", "; } } strOutput += "]}"; Response.Write(strOutput); } </code></pre> <p>NOTE!!!!!!! When adding a control, you must put your quotes for your control values as \\" because the backslash needs to be in the JSON data.</p> <p>Hopefully, in the controller you can access your webservice. I'm not too familiar with web programming, so I don't know what you'd need to do. I just thought this would help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload