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.
Unfortunately, activation email could not send to your email. Please try again.

Sort/filter is not working if using UrlAdaptor

Thread ID:

Created:

Updated:

Platform:

Replies:

131854 Jul 31,2017 09:00 AM Aug 1,2017 08:30 AM ASP.NET Core 1
loading
Tags: Grid
JP Gutton
Asked On July 31, 2017 09:00 AM

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.

Mani Sankar Durai [Syncfusion]
Replied On August 1, 2017 08:30 AM

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. 



CONFIRMATION

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.

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.

;