BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
url: "@(Url.Action("GetList","Survey"))" + "/" + $("#SurveySelector").val() });
$("#Grid").ejGrid({ locale: "pt-PT", dataSource: dataManger, allowPaging: true, allowSorting: true, allowGrouping: true, enableDropAreaAnimation: false, allowFiltering: true, filterSettings: { showFilterBarStatus: true }, columns: [ { field: "EntityValue", headerText: "Entidade", width: 70 }, { field: "EntityCreated", headerText: "Criada a", format: "{0:dd/MM/yyyy HH:mm:ss}", width: 65 }, { field: "StatusValue", headerText: "Estado", width: 40 }, { field: "AnsweredByDescription", headerText: "Respondido por", width: 60 }, { field: "Phone1", headerText: "Telefone 1", width: 40 }, { field: "Phone2", headerText: "Telefone 2", width: 40 }, { field: "MobilePhone", headerText: "Telemóvel", width: 40 }, { field: "Email", headerText: "Email", width: 90 }, { field: "", headerText: "Respostas", template: "#templateRespostas", width: 40, textAlign: ej.TextAlign.Center }, { field: "", headerText: "Operações", template: "#templateOperacoes", width: 40, textAlign: ej.TextAlign.Center } ] });
[HttpGet] public ActionResult GetList() { string surveyId = Request.Url.Segments[4].Remove(Request.Url.Segments[4].Length - 1); int topParam = int.Parse(Request.QueryString["$top"]); int skipParam = int.Parse(Request.QueryString["$skip"]); string filterParam = Request.QueryString["$filter"]; string orderByParam = Request.QueryString["$orderBy"];
Index.cshtml <script> $(function () { var dataManager = ej.DataManager({ url: "/Home/DataSource", adaptor: new ej.UrlAdaptor() });
$("#Grid").ejGrid({ locale: "pt-PT", dataSource: dataManager, allowPaging: true, allowSorting: true, allowGrouping: true, enableDropAreaAnimation: false, allowFiltering: true, filterSettings: { showFilterBarStatus: true }, columns: [ { field: "OrderID", headerText:"OrderID",width: 120 }, { field: "OrderDate", headerText: "Archived", format: "{0:yyyy/MM/dd HH:mm:ss}", width: 140 }, { field: "CustomerID",headerText:"CustomerID",width: 100 }] }); });
public ActionResult DataSource(DataManager dm) { IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); DataOperations operation = new DataOperations(); DataResult result = new DataResult(); result.result = DataSource; result.count = result.result.AsQueryable().Count(); if (dm.Skip > 0) result.result = operation.PerformSkip(result.result, dm.Skip); if (dm.Take > 0) result.result = operation.PerformTake(result.result, dm.Take); return Json(result, JsonRequestBehavior.AllowGet); } public class DataResult { public IEnumerable result { get; set; } public int count { get; set; } |
<script type="text/javascript"> $(function () { // the datasource "window.gridData" is referred from jsondata.min.js var data = ej.DataManager(window.gridData).executeLocal(ej.Query().take(50)); $("#Grid").ejGrid({ dataSource: data, isResponsive: true, minWidth: 700, allowPaging: true, allowSorting: true, columns: [ { field: "OrderID", headerText: "Order ID", width: 75 , textAlign: ej.TextAlign.Right }, { field: "CustomerID", headerText: "Customer ID", width: 80 }, { field: "EmployeeID", headerText: "Employee ID", width: 75, textAlign: ej.TextAlign.Right }, { field: "Freight", width: 75, format: "{0:C}", textAlign: ej.TextAlign.Right }, { field: "OrderDate", headerText: "Order Date", width: 80, format: "{0:MM/dd/yyyy}", textAlign: ej.TextAlign.Right }, { field: "ShipCity", headerText: "Ship City", width: 110 } ] }); }); |