How to set grid allow group in code ?
In many scenarios, when the user doesn't need the group option, we think it is better to have the drop area hidden. This was achieved by assigning a bool var to "AllowGrouping" and letting the user toggle it. It was working fine but now, after the updates it doesn't. The drop area does show and hide but any column to be grouped can't be dropped anymore. Please, see attached video showing that it was working before and below is a simplified sample that although it is not the one showed in the video it uses exactly the same code.
Attachment: GroupUngroup_d23a59e8.zip
@page "/ZLabTest/TestingPage"
<div style="padding-top: 5px;padding-bottom: 5px;">
<SfButton OnClick="@(() => { allowGroup = !allowGroup; })" Content="Group / Ungroup"></SfButton>
@allowGroup.ToString()
</div>
<div style="width: calc(100vw - 20rem);">
<SfGrid DataSource="@Orders" AllowPaging="true" Height="100%" Width="100%" AllowGrouping="@allowGroup">
<GridEvents TValue="Order"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.ShipCountry) HeaderText="Ship Country" Width="150"></GridColumn>
</GridColumns>
</SfGrid>
</div>
@code{
protected bool allowGroup = false;
public List<Order> Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
ShipCountry = (new string[] { "USA", "UK", "JAPAN" })[new Random().Next(3)]
}).ToList();
}
public class Order
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
public string ShipCountry { get; set; }
}
}
Attachment: GroupUngroup_d23a59e8.zip
SIGN IN To post a reply.
2 Replies
RS
Renjith Singh Rajendran
Syncfusion Team
April 15, 2021 10:18 AM UTC
Hi Ben,
Greetings from Syncfusion support.
We have confirmed it as a bug and logged the defect report “Problem with grouping action after dynamically enabled AllowGrouping property” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the defect fix in our weekly release which is expected to be rolled out by the end of April, 2021.
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.
Regards,
Renjith R
RS
Renjith Singh Rajendran
Syncfusion Team
August 2, 2021 01:06 PM UTC
Hi Ben,
We have resolved this issue in our (19.1.0.57) version. So we recommend you to upgrade to our latest release versions for latest fixes and features.
Please get in touch with us if you would require any further assistance.
Regards,
Renjith R
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
BJ Ben Junior
- Apr 12, 2021 09:54 PM UTC
- Aug 2, 2021 01:06 PM UTC