Reordering rows with RowDraggable is great but tricky.
Droping while the red line marker is on the upper line of a row works.
Droping while the red line marker is on the bottom line of a row brings the item to the position over the dopped line.
Thus, it is impossible to bring a line to the last position of a table (although one can bring the last row over it's predecessor as a workaround)
Using OnRowDrop works fine but there is no configuration possible to set the column at the end of the grid.
Of course it's a personnal taste but I like to have the all the actions buttons on the right side
In Grid with MultiColumnHeaders, if you programmatically change a column header, this breaks the Grid rendering. The header text isn't updated unless the number of child columns changes.
Reproduction steps:
1. Run the provided code snippet. It will bind August's data to the grid. There are 5 days in August's data, so you can see 5 child columns under "Sales by Date".
2. Click the July button. July's data also has 5 days. You will see all the cell texts are updated, but the header texts aren't.
3. If you click on the July button again. They are updated at this time.
4. Refresh the page
5. Click the June button. June's data has only 3 days, so you will see all the header texts, and the cell texts are updated as expected.
Reproduction code:
<TelerikButton OnClick="@Change0">August</TelerikButton>
<TelerikButton OnClick="@Change">July</TelerikButton>
<TelerikButton OnClick="@Change2">June</TelerikButton>
@if (AllSales.Count > 0)
{
<TelerikGrid @ref="@Grid" Data="@AllSales" Pageable="false">
<GridColumns>
<GridColumn Field="@nameof(MyViewModel.Product)">
</GridColumn>
<GridColumn>
<HeaderTemplate>
<div>Sales by Date</div>
</HeaderTemplate>
<Columns>
@{
var dates = AllSales.First().SalesByDate.Keys.OrderByDescending(d => d).ToList();
foreach (var date in dates)
{
<GridColumn Title="@date.ToString("MM/dd")">
<HeaderTemplate>
@{
Console.WriteLine(date.ToString("MM/dd"));
<div>@date.ToString("MM/dd")</div>
}
</HeaderTemplate>
<Template>
@{
var record = context as MyViewModel;
if (record.SalesByDate.ContainsKey(date))
{
<div>@record.SalesByDate[date]</div>
}
}
</Template>
</GridColumn>
}
}
</Columns>
</GridColumn>
</GridColumns>
</TelerikGrid>
}
@code {
public class MyViewModel
{
public string Product { get; set; }
public Dictionary<DateTime, decimal> SalesByDate { get; set; }
}
List<MyViewModel> AllSales { get; set; } = new List<MyViewModel>();
TelerikGrid<MyViewModel> Grid { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
Change0();
}
protected void Change0()
{
AllSales = new List<MyViewModel>();
AllSales.Add(new MyViewModel
{
Product = "Product A",
SalesByDate = new Dictionary<DateTime, decimal>
{
{ new DateTime(2021,08,01), 1000 },
{ new DateTime(2021,08,02), 2000 },
{ new DateTime(2021,08,03), 3000 },
{ new DateTime(2021,08,04), 4000 },
{ new DateTime(2021,08,05), 5000 }
}
});
AllSales.Add(new MyViewModel
{
Product = "Product B",
SalesByDate = new Dictionary<DateTime, decimal>
{
{ new DateTime(2021,08,01), 1000 },
{ new DateTime(2021,08,02), 2000 },
{ new DateTime(2021,08,03), 3000 },
{ new DateTime(2021,08,04), 4000 },
{ new DateTime(2021,08,05), 5000 }
}
});
}
protected void Change()
{
AllSales = new List<MyViewModel>();
AllSales.Add(new MyViewModel
{
Product = "Product C",
SalesByDate = new Dictionary<DateTime, decimal>
{
{ new DateTime(2021,07,01), 1010 },
{ new DateTime(2021,07,02), 2020 },
{ new DateTime(2021,07,03), 3030 },
{ new DateTime(2021,07,04), 4040 },
{ new DateTime(2021,07,05), 5050 }
}
});
AllSales.Add(new MyViewModel
{
Product = "Product D",
SalesByDate = new Dictionary<DateTime, decimal>
{
{ new DateTime(2021,07,01), 1010 },
{ new DateTime(2021,07,02), 2020 },
{ new DateTime(2021,07,03), 3030 },
{ new DateTime(2021,07,04), 4040 },
{ new DateTime(2021,07,05), 5050 }
}
});
}
protected void Change2()
{
AllSales = new List<MyViewModel>();
AllSales.Add(new MyViewModel
{
Product = "Product E",
SalesByDate = new Dictionary<DateTime, decimal>
{
{ new DateTime(2021,06,01), 1100 },
{ new DateTime(2021,06,02), 2200 },
{ new DateTime(2021,06,03), 3300 }
}
});
AllSales.Add(new MyViewModel
{
Product = "Product F",
SalesByDate = new Dictionary<DateTime, decimal>
{
{ new DateTime(2021,06,01), 1100 },
{ new DateTime(2021,06,02), 2200 },
{ new DateTime(2021,06,03), 3300 },
}
});
}
}
ADMIN EDIT
Workarounds are:
- using a "real" model instead of a dynamic type
- removing the LoadGroupsOnDemand feature (and using the regular paging so you can still have grouping in case you were using virtual scrolling)
I noticed Telerik Blazor grid is rendered into two tables. One for the headers and one for the contents.
My assumption is that Allyable Scan expects to find a th element inside the second table and it did not find any. Is my assumption correct?
Element source:
<table role="grid" style="width: ;">
In Grid with Filter Menu, I want to trigger the Filter button on Enter press while the focus is still on the filter input.
Currently, it is possible to fire filtering from keyboard only if you tab through the Filter Menu elements to focus the Filter button and then press Enter.
Currently, when you open a ColumnMenu, to expand its SubMenus (for example, Filter, Column chooser) you need to additionally click on the corresponding button.
I'd like to have these SubMenus initially expanded when the ColumnMenu is opened.
Hi,
Please lunch your demo on mobile, and try resizing a column it is very hard or impossible to do it.
Isn't possible to make resizing more pixel sensible around the separator for instance 10 pixels, and add AUTO FIT column/columns in column menu.
Best regards,
Hi,
Is it possible to use ENTER key to validate a popup filter ? instead of mouse.
Use a shortcut to open filter pop of focused column (cell). Ctrl+F or Ctrl+F3...
Yours,
Initially, the grid is filtered by "Is FTE? = True". It shows 20 lines. The sum of "Hours" should be 800. But the footer shows another value (depends on the random logic which you've implemented). See the attached screenshot.
Then, when changing the filter, the correct sum is shown.
But I need the correct value initially...
Re: I've just found out that using the OnRead event instead of the standard data binding solves the issue. Better said, it's a possible work-around.
Hi,
Is it possible to add a sub menu, in column menu so that the end user can add an aggregate operation (Sum, average...) on any column he wants and the foot panel will be automatically displayed or hidden.
Yours,
Grid virtual scrolling will freeze in the following scenario:
We are getting a problem with grid functionality after upgrading from 2.25 to 2.26. I have attached a test project. To see the problem:
We did not have this problem before version 2.26.
Just another note on this.
It appears that the presence of the checkbox columns causes the problem. Removing the checkbox columns causes the grid to work fine. Just having one checkbox template column in the grid causes the strange crash behavior in 2.26. Before 2.26, we had no problems with the checkbox templates impacting behavior.
When exporting data from a Grid using ExcelExport, the dates are visible when viewed from Excel, but not when using Open Office or Google Sheets.
I have a Grid using checkbox selection and when I un-check a row, the SelectedItemsChanged event is not firing. I'm using an async handler.
The problem appears to happen when a row is selected and then un-selected. The event is firing when it is selected but is not firing when it is un-selected.
<TelerikGrid Data="strategicLevelItems" SelectedItems="selectedStrategic" Width="100%" Height="500px"
ScrollMode="GridScrollMode.Scrollable" SelectionMode="GridSelectionMode.Multiple"
SelectedItemsChanged="@((IEnumerable<GetNavigationNodesModel> strategicItems) => OnStrategicSelectAsync(strategicItems))"
FilterMode="GridFilterMode.FilterRow">
<GridColumns>
<GridCheckboxColumn SelectAll="true" Width="40px" OnCellRender="@GridHelpers.CenterAlign" />
<GridColumn Field="@(nameof(GetNavigationNodesModel.Name))" />
</GridColumns>
</TelerikGrid>
private async Task OnStrategicSelectAsync(IEnumerable<GetNavigationNodesModel> selectedItems)
{
selectedStrategic = selectedItems;
var state = tacticalGrid.GetState();
var compositeFilter = new CompositeFilterDescriptor() { LogicalOperator = FilterCompositionLogicalOperator.Or };
foreach (var item in selectedItems)
{
compositeFilter.FilterDescriptors.Add(new FilterDescriptor()
{
Member = "ParentId",
Operator = FilterOperator.IsEqualTo,
Value = item.Id
});
}
state.FilterDescriptors.Clear();
state.FilterDescriptors.Add(compositeFilter);
await tacticalGrid.SetState(state);
}