AllowGrouping not working
Hello,
I've worked thru all the different threads (in particular this one: https://www.syncfusion.com/forums/184459/sf-grid-with-allowgrouping-equals-to-quottruequot-is-not-working-grouping-is-not-allowed ) and cannot get the grouping to work. my environment is
Windows 11 pro, VS2022 (fully updated), and using Blazor 28.1.37. New project - Blazor Server app , .net 7
I'm following this example with the youtube: https://blazor.syncfusion.com/documentation/datagrid/getting-started
The drag & drop is just not working. I can click on the column title but it won't drag.
Thank you,
Bill
From _Host.cshtml
@page "/"
@namespace synchfusion_datagrid01.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
<component type="typeof(App)" render-mode="ServerPrerendered" />
<head>
<link rel='nofollow' href="_content/Syncfusion.Blazor/styles/fabric.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
</head>
From the Index.razor file:
@page "/"
<SfGrid DataSource="@Orders" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="true">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
<GridColumn Field="@nameof(Order.OrderID)"
HeaderText="Order ID"
TextAlign="TextAlign.Right"
Width="120">
</GridColumn>
<GridColumn Field="@nameof(Order.CustomerID)"
HeaderText="Customer ID"
TextAlign="TextAlign.Right"
Width="150">
</GridColumn>
<GridColumn Field="@nameof(Order.OrderDate)"
HeaderText="Order Date"
TextAlign="TextAlign.Right"
Format="d"
Type="ColumnType.Date"
Width="130">
</GridColumn>
<GridColumn Field="@nameof(Order.Freight)"
HeaderText="Freight"
Format="C2"
TextAlign="TextAlign.Right"
Width="120">
</GridColumn>
</GridColumns>
</SfGrid>
@code{
public List<Order> Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 15).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)
}).ToList();
}
public class Order {
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
}
From Program.CSusing Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using synchfusion_datagrid01.Data;
using Syncfusion.Blazor;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddServerSideBlazor();
builder.Services.AddSyncfusionBlazor();
var app = builder.Build();
//Register Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("my id was here");
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
Hi Bill Cummings,
Based on the reported problem, we were able to replicate the issue using the
code snippet. The issue occurred because the script reference was defined
incorrectly. In the YouTube video, we demonstrated the installation of the
Syncfusion.Blazor NuGet package, but in your code, the script reference is for
the individual NuGet package. Kindly refer to the code snippet and sample
provided for your reference.
|
<!--Use below script reference if you are using Syncfusion.Blazor Single NuGet--> <script src="_content/Syncfusion.Blazor/scripts/syncfusion-blazor.min.js" type="text/javascript"></script> |
Regards,
Prathap Senthil
Attachment: BlazorDataGridGrouping_ae995c1a.zip
- 1 Reply
- 2 Participants
-
BC Bill Cummings
- Jan 2, 2025 01:49 AM UTC
- Jan 2, 2025 12:54 PM UTC