I have a grid that is using a UrlAdaptor with filtering. The code for the executing the filter in the controller works fine, that is if a data is found that matches the filter. But if no data is found, the grid is constantly showing the loading icon (ejWaiting) and the code is looped. Is there a way to stop this? Such that if there is no data to be displayed matching the filter it should show "No records to display" in the grid. Thanks.
var userSrc = ej.DataManager({
url: "../Account/GetUsers",
adaptor: "UrlAdaptor",
});
$("#UserGrid").ejGrid({
dataSource: userSrc,
allowPaging: true,
pageSettings: { currentPage: 1, pageSize: 5 },
allowFiltering: true,
filterSettings: { filterType: ej.Grid.FilterType.FilterBar, enableCaseSensitivity: false },
allowSorting: true,
allowTextWrap: true,
enableTouch: false,
columns: [
{ field: "UserId", headerText: "UserId", width: 75, isPrimaryKey: true, visible: false, allowEditing: false },
{ field: "FirstName", headerText: "First Name", width:150 },
{ field: "LastName", headerText: "Last Name", width:150 },
{ field: "UserName", headerText: "Email Address", width:180 },
{ field: "Role", headerText: "Role", width:150 },
{ field: "PhoneNo", headerText: "Phone Number", width: 120 },
],
rowSelected: LoadUserInfo,
actionBegin: UserActionBegin,
});
public ActionResult GetUsers(Syncfusion.JavaScript.DataManager dm)
{
MaintenanceRepository mr = new MaintenanceRepository();
var gdata = mr.GetUsers().ToList();
int count = gdata.AsQueryable().Count();
IEnumerable data = gdata;
DataResult ds = new DataResult();
DataOperations obj = new DataOperations();
ds.result = obj.Execute(data, dm);
ds.count = count;
return Json(ds, JsonRequestBehavior.AllowGet);
}