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
close icon

ej-datamanager-filter Menu



Here , i am using  viewBag-datasource and datamanager for Grid  . my problem is filtermenu is not working while using datamanager but it is working while using viewbag...pls give some example code...  thank you

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team February 7, 2017 01:07 PM UTC

Hi Tamil, 
 
Thanks for contacting Syncfusion Support.  
 
We suspect that you are using the jQuery v2.x.x. In this version, classes like DataManager were not properly extended and returns the plain object which in turn affect the DataManager operation. So we suggest to use the jQuery 3.x version in your application. We have prepared a sample in two different versions of jQuery. 
 
 
If you are still facing any problem, please share the following details to analyze the problem at our end.  
 
1)      Code example of the Grid and code behind 
2)      Version of the Essential Studio and jQuery 
3)      Stacktrace of browser console (if any error) 
4)      Screenshot with replication procedure or video demo for an issue 
 
If you are using the UrlAdaptor, you have to handle the server filtering in the server-end as follows. 
 
<div id="Grid"></div> 
 
<script type="text/javascript"> 
    $(function () { 
        var dataManager = ej.DataManager({ 
            url: "http://localhost:53477/Home/DataSource", 
            adaptor: new ej.UrlAdaptor() 
        }); 
        $("#Grid").ejGrid({ 
            dataSource: dataManager, 
            allowSorting: true, 
            allowFiltering: true, 
            allowReordering: true, 
            filterSettings: { 
                filterType: ej.Grid.FilterType.Menu 
            }, 
              . ..  
        }); 
    }); 
</script> 
 
        public ActionResult DataSource(DataManager dm, bool? ckFlagTratt) 
        { 
 
                IEnumerable Data = dp.convertToTypedList(DsFestivita); 
                int count = 0; 
 
                DataOperations operation = new DataOperations(); 
 
                                                                                                             
                if (dm.Where != null && dm.Where.Count > 0) 
                { 
                    Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Operator); 
                    if (!dm.RequiresCounts)//when count doesn't requires, result alone will be returned 
                        return Json(Data, JsonRequestBehavior.AllowGet);//Return records alone for the autoComplete list 
                } 
                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); 
        } 
 
We have also discussed about the server APIs for handling the server actions. Refer to the following KB. 
 
 
Regards, 
Seeni Sakthi Kumar S. 


Loader.
Live Chat Icon For mobile
Up arrow icon