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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exception on grid sorting

Thread ID:

Created:

Updated:

Platform:

Replies:

144935 May 29,2019 10:58 AM UTC May 30,2019 04:01 PM UTC Blazor 1
loading
Tags: Grid
Jawaid
Asked On May 29, 2019 10:58 AM UTC

I get following exception when I click column to sort,

System.InvalidOperationException: No generic method 'OrderBy' on type 'System.Linq.Queryable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic

here is my code

@page "/roles"
@using CMSAdmin.Shared
@using Syncfusion.EJ2.RazorComponents
@using Syncfusion.EJ2.RazorComponents.Grids
@using Syncfusion.EJ2.RazorComponents.Inputs
@using Syncfusion.EJ2.RazorComponents.Popups
@inject HttpClient Http

@if (roles == null)
{
    <p><em>Loading...</em></p>
}
else
{
    <EjsGrid id="Grid" DataSource="@roles" AllowSorting="true">
    <GridColumns>
        <GridColumn Field=@nameof(Role.Id) HeaderText="Id" Visible="false" AllowSorting="true" ></GridColumn>
        <GridColumn Field=@nameof(Role.Name) HeaderText="Role" AllowSorting="true" ></GridColumn>
        <GridColumn Field=@nameof(Role.Description) HeaderText="Description" AllowSorting="false" ></GridColumn>
        <GridColumn Field=@nameof(Role.IsActive) HeaderText="Is Active" AllowSorting="false" ></GridColumn>
    </GridColumns>
</EjsGrid>
}

@functions {
    //Role[] roles;
    IList<Role> roles;
    EjsGrid defaultGrid;
    protected override async Task OnInitAsync()
    {
        roles = await Http.GetJsonAsync<IList<Role>>("api/roles");
    }
}


Hariharan J V [Syncfusion]
Replied On May 30, 2019 04:01 PM UTC

Hi Jawaid, 
  
Thanks for contacting Syncfusion support. 
  
We have checked your query and tried to reproduce the issue, but it the sorting is working fine at our end. We have prepared a sample where you can sort the columns without any issue. Please refer the below code snippet and sample link. 
  
[Index.razor] 
@page "/" 
  
<h1>Hello, world!</h1> 
  
Welcome to your new app. 
  
<SurveyPrompt Title="How is Blazor working for you?" /> 
  
@using Syncfusion.EJ2.RazorComponents.Grids; 
@using WebApplication1.Shared.Models; 
@using Syncfusion.EJ2.RazorComponents.TreeGrid; 
  
@inject HttpClient  client 
  
<EjsGrid id="Grid" ref="@grid" DataSource="@data" AllowSorting="true"> 
        <GridColumns> 
            <GridColumn Field="@nameof(Employee.EmployeeID)" HeaderText="Order ID" ISPrimaryKey="true" TextAlign="@Syncfusion.EJ2.RazorComponents.Grids.TextAlign.Right" Width="90" AllowSorting="true"></GridColumn> 
            .   .  .  . 
            <GridColumn Field="@nameof(Employee.City)" HeaderText="City" Width="150" AllowSorting="false"></GridColumn> 
        </GridColumns> 
    </EjsGrid> 
  
@functions{ 
    Employee[] data; 
  
    EjsGrid grid; 
  
    protected override async Task OnInitAsync() 
    { 
        this.data = await client.GetJsonAsync<Employee[]>("api/Default"); 
        StateHasChanged(); 
        this.grid.DataBind(); 
    } 
} 
  
  
  
If you are still facing the issue please provide the below details that will be helpful for us to provide a better solution as early as possible. 
  
  1. Share the stack trace of the exception.
  2. Share the reproducible sample/video demo of the issue.
  
Regards, 
Hariharan 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon