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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Filtering

Thread ID:





121170 Nov 16,2015 09:54 PM UTC Nov 17,2015 06:55 AM UTC JavaScript 1
Tags: ejGrid
Asked On November 16, 2015 09:54 PM UTC

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

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon