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

Custom filter (Excel)

Hello,

Trying to implement Excel filtering and almost evertyhing works fine apart suggestions in custom filter textfield. My current return format from backend for grid (json) is:
{ result: [{}, {}, {} ..], count: 0 } - I see that by my request, I do return those records, but suggestion list can't find anything. Do I need different return format? If yes, how do I know which format to return when it's for Grid and Suggestions list? When I stop typing in textfield, it makes this request:


1 Reply

JK Jayaprakash Kamaraj Syncfusion Team June 7, 2017 10:23 AM UTC

Hi Customer, 

Thank you for contacting Syncfusion support. 

To overcome this problem, we suggest you to return records alone in server side when dm.RequiresCounts as false for display autocomplete suggestion list. Please refer to the below code example. 


 public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) 
        { 
            IEnumerable Data = OrderRepository.GetAllRecords(); 
            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations(); 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                Data = operation.PerformSorting(Data, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Operator); 
                if (!dm.RequiresCounts) 
                    return Json(Data); //Return records alone for the autoComplete list 
            } 
            int count = Data.AsQueryable().Count(); 
            if (dm.Skip != 0) 
            { 
                Data = operation.PerformSkip(Data, dm.Skip); 
            } 
            if (dm.Take != 0) 
            { 
                Data = operation.PerformTake(Data, dm.Take); 
            } 
            return Json(new { result = Data, count = count }, JsonRequestBehavior.AllowGet); 
        } 

Regards, 
 
Jayaprakash K. 


Loader.
Up arrow icon