We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Filtering

Hi Team,

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",
        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);          

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team November 17, 2015 06:55 AM UTC

Hi Lory,

We are unable to reproduce the issue at our end. If the filtered record is not in the corresponding column, Grid shows the “No records to display”. Please refer to the screenshot.

With the provided code example, we have prepared a sample that can be downloaded from the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/121170/ze/ejGrid-js-1490226499

If you are still facing any difficulty, please share the following details which will help us to provide a solution as earliest.

1)      Stack trace of browser console (if any error)
2)      Code example used in the actionBegin event of the Grid.
3)      Modify the attached sample replicate the issue.

In the provided code example, the original datasource count has been reassigned in  ds.count. It will show an incorrect record count after filtering the Grid as shown in below image.

To avoid this, we suggest to use below code example.

public ActionResult DataSource(DataManager dm)


            IEnumerable Data = OrderRepository.GetAllRecords();

            int count = Data.AsQueryable().Count();

            DataOperations operation = new DataOperations();

            Data = operation.Execute(Data, dm);

            if (dm.Where != null)


                count = Data.AsQueryable().Count();//updates the origninal record count after filtering


            return Json(new { result = Data, count = count }, JsonRequestBehavior.AllowGet);

Seeni Sakthi Kumar S.

Live Chat Icon For mobile
Up arrow icon