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

Grid CustomAdaptor menu filter on input error (17.4.40)

When using grid customadapter menu filter, on input following error occurs.



<EjsGrid TValue="BusinessSectorList" ID="Grid" AllowSorting="true" AllowFiltering="true" AllowPaging="true">
    <EjsDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></EjsDataManager>
    <GridFilterSettings Type="Syncfusion.EJ2.Blazor.Grids.FilterType.Menu" ></GridFilterSettings>
    <GridPageSettings PageSize="8"></GridPageSettings>
    <GridColumns>
        <GridColumn Field=@nameof(BusinessSectorList.Id) IsPrimaryKey="true" TextAlign="@TextAlign.Center" Width="140"></GridColumn>
        <GridColumn Field=@nameof(BusinessSectorList.Name) Width="150"></GridColumn>
    </GridColumns>
</EjsGrid>

@code {

    public class BusinessSectorList
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

    // Implementing custom adaptor by extending the DataAdaptor class
    public class CustomAdaptor : DataAdaptor
    {
        private MyContext db = new MyContext();

        // Performs data Read operation
        public override object Read(DataManagerRequest dm, string key = null)
        {

            IQueryable<BusinessSectorList> DataSource = db.BusinessSector.Select(x => new BusinessSectorList
            {
                Id = x.Id,
                Name = x.Name
            });

            if (dm.Search != null && dm.Search.Count > 0)
            {
                // Searching
                DataSource = DataOperations.PerformSearching(DataSource, dm.Search);
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0)
            {
                // Sorting
                DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0)
            {
                // Filtering
                DataSource = DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Cast<BusinessSectorList>().Count();
            if (dm.Skip != 0)
            {
                //Paging
                DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);
            }
            if (dm.Take != 0)
            {
                DataSource = DataOperations.PerformTake(DataSource, dm.Take);
            }
            return dm.RequiresCounts ? new DataResult() { Result = DataSource.ToList(), Count = count } : (object)DataSource.ToList();
        }
    }

3 Replies

VN Vignesh Natarajan Syncfusion Team January 3, 2020 11:34 AM UTC

Hi Ashimaz,  

Greetings from Syncfusion support.  

Query: ”When using grid customadapter menu filter, on input following error occurs.” 
 
We are able to reproduce the reported issue at our end when we bind Iqueryable data directly to Grid. Since it is known issue we have already considered this as a usability feature improvement “Problem with DataOperations when bind IQueryable data to Grid”, and logged a defect report for the same. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts. Feature will be implemented in any of the upcoming releases.  
 
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We have planned to implement this usability feature in our next release 2019 Volume 4 Service Pack 1 which is expected to be rolled out in month end of January 2020.  
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.   

 
Until then we suggest you to bind List values to Grid to overcome the problem you are facing. please refer the below code example. 

 
public Object Post([FromBody]DataManagerRequest dm) 
        { 
            // Here we have converted dataSource as list to resolve the problem 
            IEnumerable DataSource = db.Orders.Select(x => new Order 
            { 
                OrderID = x.OrderID, 
                EmployeeID = x.EmployeeID, 
                CustomerID = x.CustomerID 
            }).ToList(); 
. . . . .. . . . . .  
        } 


Please get back to us if you need further assistance. 

Regards, 
Vignesh Natarajan. 



AS ashimaz January 3, 2020 06:56 PM UTC

Thank you.

I believe this is a important usability feature to fix and hoping this will be fixed in next release.
IEnumerable is not efficient way to query database.


VN Vignesh Natarajan Syncfusion Team January 6, 2020 06:37 AM UTC

Hi Ashimaz,  

Thanks for the update.  

Query: “I believe this is a important usability feature to fix and hoping this will be fixed in next release. 

Reported usability feature will be implemented as promised. We will get back to you once our 2019 Volume 4 Service Pack 1 get successfully rolled out which is expected to be rolled out on or before 29th January 2020

Till then we appreciate your patience. 

Regards, 
Vignesh Natarajan. 


Loader.
Up arrow icon