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

Grid: Cannot group by a templated column

Thread ID:

Created:

Updated:

Platform:

Replies:

150722 Jan 17,2020 04:01 AM UTC Jan 20,2020 02:09 PM UTC Blazor 1
loading
Tags: Grid
Responsive Edge
Asked On January 17, 2020 04:01 AM UTC

In an EjsGrid, is it possible to group by a templated column?

```
<GridColumn HeaderText="MyText" Width="200">
                            <Template>
                                @{
```

When I drop the column onto the drag bar, nothing happens. I notice that the GridGroupSettings Columns property expects GridColumn Field names but my templated GridColumn doesn't use a Field.

Renjith Singh Rajendran [Syncfusion]
Replied On January 20, 2020 02:09 PM UTC

Hi Customer, 

Thanks for contacting Syncfusion support. 

We suggest you to set the Field property for the template column to Group Grid based on that template column. Please use the codes below, 

 
    <EjsGrid DataSource="@Orders" AllowGrouping="true" Height="315"> 
        <GridColumns> 
            <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" Width="120"></GridColumn> 
            <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150">    @*Set Field property for template column*@ 
                <Template> 
                    @{  
                        var data = context as Order; 
                        <div>@data.CustomerID</div> 
                    } 
                    </Template> 
            </GridColumn> 
       </GridColumns> 
    </EjsGrid> 
 
@code{ 
    ... 
    public class Order 
    { 
        public int? OrderID { get; set; } 
        public string CustomerID { get; set; } 
        public DateTime? OrderDate { get; set; } 
        public double? Freight { get; set; } 
    } 
} 


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


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