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

Sort/filter is not working if using UrlAdaptor

Hi,

I have issues with the Grid control when using UrlAdaptor for DataManager. The controller return json from a dynamic object, the rows are shown in the Grid but I can't sort them or filter them, for sorting the up or down arrow is shown when clicking in the header but the rows' order stay the same, filtering does nothing.

If I switch to remoteSaveAdaptor, sorting/filtering works but then I have issue when adding a new row, the dialog template stay opened with the spinner running, if I refresh the page, the new row is present.

Any help will be appreciated.

5 Replies

MS Mani Sankar Durai Syncfusion Team August 1, 2017 12:30 PM UTC

Hi Gutton, 

Thanks for contacting Syncfusion support. 

Query 1: I have issues with the Grid control when using UrlAdaptor for DataManager.  
   We have analyzed your and we suspect that you would like to perform sorting and Filtering operation when using UrlAdaptor in grid. When using the UrlAdaptor we suggest you to perform server side operation in grid when performing sorting, filtering, paging, grouping etc.., 
Refer the code example. 
@(Html.EJ().Grid<object>("Grid") 
                     .Datasource(ds => ds.URL("/Home/DataSource").Adaptor("UrlAdaptor")) 
                     .AllowPaging() 
                          .ToolbarSettings(toolbar => 
            { 
                toolbar.ShowToolbar().ToolbarItems(items => 
                { 
                    items.AddTool(ToolBarItems.Search); 
                }); 
            }) 
                     .Columns(col => 
        { 
            ... 
           })    ) 
 
In the server side we can get it from the DataManager Class which contains the object for every grid actions like filtering, sorting, grouping, skip and take (i.e paging) etc..,  
Refer the code example. 
[HomeController.cs] 
public ActionResult DataSource(DataManager dm) //Using DataManager class which contains Sorting, filtering as a parameter.   
        {….    } 
 
Please refer the below code example which contains server side operations. Using DataOperations class each actions in grid takes place. 

using Syncfusion.JavaScript.DataSources; 
using Syncfusion.Linq; 
using Syncfusion.JavaScript.Models; 
 
public ActionResult DataSource(DataManager dm) 
        { 
            IEnumerable data = OrderRepository.GetAllRecords().ToList(); 
            DataOperations operation = new DataOperations(); 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                data = operation.PerformSorting(data, dm.Sorted); 
            } 
          if (dm.Search != null && dm.Search.Count > 0) 
            { 
                Data = operation.PerformSearching(Data, dm.Search);  //perform search operation in grid. 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator); 
            } 
            int count = data.Cast<EditableOrder>().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 }); 
        } 
        public class DataResult 
        { 
            public IEnumerable result { get; set; } 
            public int count { get; set; } 
        } 
 
 
Refer the documentation link.  
 
Refer the KB link of how to perform server side grid actions 
 
We have also prepared a sample that can be downloaded from the below link. 

Query 2: If I switch to remoteSaveAdaptor, sorting/filtering works but then I have issue when adding a new row, the dialog template stay opened with the spinner running, 
 
We have checked based on your query and when using remoteSaveAdaptor grid actions like sorting, filtering, paging will takes place locally. When editing we have checked with dialog template and we are not able to reproduce the reported issue. If you are performing server side CRUD operation refer the documentation link 
 
Refer the online sample link: 
If you still face the issue please get back to us with the following details. 
1.       Share the screenshot/ video of the issue that you have faced. 
2.       Share the full grid code  
3.       Share the controller page 
4.       If possible please reproduce the issue in the simple sample 
The provided information will help us to analyze the issue and provide you the response as early as possible. 
Please let us know if you need further assistance 
 
Regards, 
Manisankar Durai. 




CO Costa October 29, 2018 02:29 PM UTC

Hi. Please give an updated working example from Query1 for ASP NET Core Razor Pages (Essential JS 1). I tried to build a similar example on Razor Pages, but DataManager dm is always empty.
Thanks.


VN Vignesh Natarajan Syncfusion Team October 30, 2018 09:26 AM UTC

Hi Costa, 
 
Thanks for using Syncfusion products. 
 
From your query, we understand that you are facing issue while using Url Adaptor with razor view pages in ASP.NET Core. We have already documented your request in our knowledge base section. Kindly refer the below link for the knowledge base document 
 
 
As per your request we have prepared a sample using razor pages in ASP.NET Core and URL adaptor which can be downloaded from below link 
 
 
If you still face the issue please get back to us with more details regarding the issue   
 
 
Regards, 
Vignesh Natarajan 



CO Costa October 30, 2018 11:44 AM UTC

Greetings the best Support Service I have ever seen. Thank you!



VN Vignesh Natarajan Syncfusion Team October 31, 2018 04:34 AM UTC

Hi Costa, 


Thanks for the update.  


We are happy to hear that your query has been resolved by our solution. 


Please get back to us if you have any further queries. 


Regards, 
Vignesh Natarajan 


Loader.
Live Chat Icon For mobile
Up arrow icon