I'm having some issues with implementing a jQuery bootgrid using ASP.Net MVC. I can't implement the sorting, searching, pagination etc. functionality.
This is what I have in my controller:
public JsonResult IndexJson(BootgridRequestData model)
{
var contacts = (from x in db.ContactSet
select new
{
x.AccountId,
x.FirstName,
x.LastName,
x.FullName,
x.JobTitle,
x.ParentCustomerId,
x.EMailAddress1,
x.Telephone1,
x.MobilePhone,
x.Fax,
x.GenderCode,
x.BirthDate
}).ToList();
// This tResult throws a Non-invocable member cannot be used like a method error.
var tResult = BootgridResponseData<JsonResult>() {
current = model.current,
rowCount = model.rowCount,
rows = contacts,
total = contacts.Count
};
return Json(tResult, JsonRequestBehavior.AllowGet);
}
Then I have the following helper classes:
public class BootgridRequestData
{
public int current { get; set; }
public string rowCount { get; set; }
public string searchPhrase { get; set; }
public IEnumerable<SortData> sortItems { get; set; }
}
public class BootgridResponseData<T> where T : class
{
public int current { get; set; } //? current page
public int rowCount { get; set; } //? rows per page
public IEnumerable<T> rows { get; set; } //? items
public int total { get; set; } //? total rows for whole query
}
public class SortData
{
public string Field { get; set; } //? Field Name
public string Type { get; set; } //? ASC or DESC
}
I'm not really too sure where to go from here. Any advice?