Dear Team,
I am wanted to implement remote paging, filtering and sorting in one of my project which is in MVC 5. So far whatever I got from web is not enough to implement the same.
Below is my cshtml code. I am getting data from controller in json format.
$('#Demo).igGrid({
width: "100%",
dataSource: data,
responseDataKey: "Records",
dataSourceType: "json",
autoGenerateLayouts: false,
autoGenerateColumns: false,
columns: [
{ headerText: "No", key: "DeclarationNo",dataType: "number", template: "<a href='http://localhost:14152/Home/Sample/1' > ${DeclarationNo} </a>" },
{ headerText: "Article No", key: "ArticleNo", template: "<a href='http://localhost:14152/Home/Sample/1' > ${ArticleNo} </a>" },
{ headerText: "Article Name", key: "ArticleName", template: "<a href='http://localhost:14152/Home/Sample/1' > ${ArticleName} </a>" },
{ headerText: "Site Name", key: "SiteName", template: "<a href='http://localhost:14152/Home/Sample/1' > ${SiteName} </a>" },
],
features: [
{
name: 'Paging',
pageSize: 5,
type: "remote",
pageSizeDropDownLocation: "inpager",
},
name: 'Filtering',
mode: "advanced",
advancedModeEditorsVisible: true,
name: "ColumnMoving",
addMovingDropdown: true,
mode: "deferred",
type: "render"
name: "Sorting",
}
});
2 – Below is my controller code
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult GetAllDeclaration()
var listofDeclaration = GetPagedData();
var model = listofDeclaration.Data.AsQueryable();
return Json(model, JsonRequestBehavior.AllowGet);
public GridPagingInformation<Sample> GetPagedData(int pageSize = 10, int pageIndex = 0)
//var data = _sampleDataProvider.GetData(stateid);
var data = _sampleDataProvider.GetData();
var pagedData = data.Skip(pageIndex * pageSize).Take(pageSize).ToList();
var listofstringfile = (data.Select(x => x.ArticleNo).ToList().Distinct());
ViewBag.StringField = JsonConvert.SerializeObject(listofstringfile);
var result = new GridPagingInformation<Sample>
Data = pagedData,
PageNumber = pageIndex,
PageSize = pageSize,
TotalRecords = data.Count
};
return result;
Hello Rahul,
Did you have a chance to read our documentation related to these features and their remote implementations:
- Paging: http://www.igniteui.com/help/iggrid-paging#remote
- Filtering: http://www.igniteui.com/help/iggrid-filtering#remote
- Sorting: http://www.igniteui.com/help/iggrid-sorting-overview#remote and related sample: http://www.igniteui.com/grid/sorting-remote
It would be great appreciated also if you can send me an isolated sample project as a starting point from where I can show you how to implement remote paging, filtering and sorting. If I can assist you further, please let me know.
Regards,
Tsanna