Hi,
Within our Blazor application I use a Grid with custom row filters:
<TelerikGrid Data="@RecordList"
SelectionMode="GridSelectionMode.Multiple"
Width="100%"
Pageable="true"
PageSize="@PageSize"
FilterMode="@GridFilterMode.FilterRow"
Sortable="true"
Groupable="false"
Height="760px"
Resizable="true">
<GridColumns>
<GridColumn Width="200px" Field="@nameof(Demo.Name)" Title="@L["Name"]">
<FilterCellTemplate>
<CustomListRowFilter Context="@context" ListValues="EmployeeFilterList" AddNoneItem="false" />
</FilterCellTemplate>
</GridColumn>
<GridColumn Width="200px" Field="@nameof(Demo.Datum)" Title="@L["Date"]">
<FilterCellTemplate>
<CustomDateSpanRowFilter Context="@context" InitialValueFrom="@InitialDateFromFilter" InitialValueTo="@InitialDateToFilter" />
</FilterCellTemplate>
</GridColumn>
<GridColumn Width="200px" Field="@nameof(Demo.Hours)" Title="@L["Hours"]">
<FilterCellTemplate>
<CustomNumberRowFilter Context="@context" />
</FilterCellTemplate>
<FooterTemplate>
<span>Total: @context.Sum?.ToString("0.00")</span>
</FooterTemplate>
</GridColumn>
<GridColumn Width="200px" Field="@nameof(Demo.Checked)" Title="@L["Checked"]">
<FilterCellTemplate>
<CustomBooleanRowFilter Context="@context" InitialValue="false" />
</FilterCellTemplate>
<Template>
<input type="checkbox" checked="@(((Demo) context).Checked)" @onchange="@(args => OnCheckChanged((Demo) context, args))" />
</Template>
</GridColumn>
</GridColumns>
<GridAggregates>
<GridAggregate Field=@nameof(Demo.Hours) Aggregate="@GridAggregateType.Sum" />
</GridAggregates>
</TelerikGrid>
For example, the custome date filter looks like:
<select value="@Value" @onchange="OnFilterChanged">
<option value="@string.Empty">All</option>
<option value="True">True</option>
<option value="False">False</option>
</select>
@code {
private string Field { get; set; }
private string Value { get; set; }
private bool? _boolValue;
[Parameter]
public FilterCellTemplateContext Context { get; set; }
[Parameter]
public bool? InitialValue { get; set; }
protected override async Task OnInitializedAsync()
{
Field = ((FilterDescriptor) Context.FilterDescriptor.FilterDescriptors[0])?.Member;
if (InitialValue != null)
{
SetValue(InitialValue.Value);
await SetFilter();
}
else
{
SetValue(((FilterDescriptor)Context.FilterDescriptor.FilterDescriptors[0]).Value);
}
}
private void SetValue(object value)
{
if (string.IsNullOrEmpty(value?.ToString()) || value.ToString() == "All")
{
_boolValue = null;
Value = string.Empty;
}
else
{
bool.TryParse(value.ToString(), out var parseResult);
_boolValue = parseResult;
Value = _boolValue.ToString();
}
}
protected async Task OnFilterChanged(ChangeEventArgs args)
{
var value = args.Value;
SetValue(value);
await SetFilter();
}
private async Task SetFilter()
{
if (_boolValue != null)
{
var filterDescriptors = Context.FilterDescriptor.FilterDescriptors.Where(descriptor =>
((FilterDescriptor)descriptor).Member == Field).ToList();
var filterDescriptor = (FilterDescriptor) filterDescriptors[0];
filterDescriptor.Value = _boolValue;
((FilterDescriptor)filterDescriptors[0]).Operator = FilterOperator.IsEqualTo;
await Context.FilterAsync();
}
else
{
await Context.ClearFilterAsync();
}
}
}In my example the filter for the column "Checked" gets an initial value when page is loaded. The grid filters correctly. But the sum of the hours column show the overall sum and not the filtered one.
Do I miss something? Maybe within the filter component?
Best regards,
Rayko

Hi Team,
As i'm not able to copy the text when you select folder path and it is showing as exception.
Could not find 'clipboard' in 'window.navigator'. Error: Could not find 'clipboard' in 'window.navigator'. at
Please check below code snippet.
public class ClipBoardService
{
private readonly IJSRuntime _jsRuntime;
public ClipBoardService(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
public ValueTask WriteTextAsync(string text)
{
return _jsRuntime.InvokeVoidAsync("navigator.clipboard.writeText", text);
}
}
<GridCommandButton Command="View" OnClick="@CopySelectedItemClicked" Title="Click to view folder containing this file">View</GridCommandButton>
if(clipBoardService != null)
{
await clipBoardService.WriteTextAsync(selectedItem.IsolationFolderPath);
}

Hi,
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. Is there any reason for this? Can it be addressed, as increasing numbers of people use these methods for viewing Excel files.
Output file is attached - see final column in Open Office or Google Sheets.
Thanks,
Dean

I have a grid using checkbox selection and when I un-check a row, it is not firing the SelectedItemsChanged event.
The event adds filters to another grid I have on the page.
<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);
}
Hi,
I want to export the data which is shown in a Grid. The Grid is filterable, groupable and contains a Sum aggregate.
The built-in export function is a bit too inflexible regarding the the formatting etc. So I need to create an own Excel report and I need to pull the (flat) data out of the Grid. Only data which is shown on the page (filtered etc) should be exported. So I need to get the "processed" Grid data.
Does anyone know how to get the data?
I've already tried to use the OnRead event pull that data. But together with grouping and a Sum aggregate the I get the error:
"Error: System.InvalidOperationException: No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic."
This behaviour is already explained here: https://feedback.telerik.com/blazor/1516871-manual-source-operations-with-grouping-and-aggregates.
But no solution so far.
Best regards,
Rayko
Hi,
My PM is wanting us to capture the column resize event and save this so when a user comes back to a certain page the column widths are set to the previous widths they set.
Is there a way to capture the a column resize width and the widths of the columns?
Thanks
Hello,
This v2.26.0 drop down:
<div class="flex-child">
<label for="warehouse" class="k-label k-form-label">Warehouse</label>
<TelerikDropDownList Data="@Warehouses" DefaultText="Select a Warehouse"
Id="warehouse"
TextField="WarehouseName"
ValueField="WarehouseId"
ValueChanged="@((int w) => WarehouseSelected(w))" />
</div>
...is working in a Blazor WASM app (well, I'm having issues overriding css classes used by Telerik controls, but that's another topic).
Here it is, working OK in Blazor WASM:
However, using the same code in a Razor component in a Blazor-Server project, I am not getting the control rendered properly:
I have your script declared in the head part of _Host.cshtml (see below). I'm really not sure about this, and I have moved it around , removed "defer", deleted bin and obj folders and cleared the cache, but to no avail.
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CalendarDemo.UI</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="CalendarDemo.UI.styles.css" rel="stylesheet" />
<link href="css/CustomStyles.css" rel="stylesheet" />
<script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js" defer></script>
</head>Looking at the dev tools, I do see the above script is making it to the page:
This is a mystery to me so far. I am not seeing any exceptions being raised.
Any suggestions for further troubleshooting? Thanks again!
Is there a way to prevent the user from selecting dates in the past?
When the current month is shown, I assume I need to create a List<DateTime> containing all the dates in the current month that are in the past and assign that List to the calendar's DisabledDates. If there is another way, please advise.
The other part of this question is: How we prevent the user from even viewing past months?
Thanks a lot!
