Hello,
I tried to implement a TelerikRadioGroup bound to an enum by following Marin's example code posted here, but I'm doing something wrong. I have attached my Razor component as a TXT file.
The result when I run the code is this:
Thanks again for your support.
Francis
I've just started to look into building custom filter templates and using the example here to help me.
I've noticed that when I click the 'Clear' button, it will clear the checkbox items but if I select a new item, on hitting 'Filter' it will re-add previous selections to the filter and they will show on the checkbox menu again.
Can someone show me how I'd modify the example to rectify this please, and get it to filter correctly after clearing the intial selection?
This is the code from the example I've used, unmodified:
@using Telerik.DataSource
This custom filter menu lets you choose more than one option to match against the data source
<TelerikGrid Data=@GridData FilterMode="@GridFilterMode.FilterMenu"
Height="400px" Width="600px" Pageable="true">
<GridColumns>
<GridColumn Field="Id" Filterable="false" Width="80px" />
<GridColumn Field="Size">
<FilterMenuTemplate>
@{
// we store a reference to the filter context to use in the business logic to show we can
// we could, alternatively pass it as an argument to the event handler in the lambda expression
// which can be useful if you want to use the same filter for several columns
// you could then pass more arguments to the business logic such as field name and so on
theFilterContext = context;
}
@foreach (var size in Sizes)
{
<div>
<TelerikCheckBox Value="@(IsCheckboxInCurrentFilter(context.FilterDescriptor, size))"
TValue="bool"
ValueChanged="@((value) => UpdateCheckedSizes(value, size))"
Id="@($"size_{size}")">
</TelerikCheckBox>
<label for="@($"size_{size}")">
@if (size == null) // part of handling nulls - show meaningful text for the end user
{
<text>Empty</text>
}
else
{
@size
}
</label>
</div>
}
</FilterMenuTemplate>
</GridColumn>
<GridColumn Field="ProductName" Title="Product" Filterable="false" />
</GridColumns>
</TelerikGrid>
@code {
FilterMenuTemplateContext theFilterContext { get; set; }
public List<string> CheckedSizes { get; set; } = new List<string>();
public bool IsCheckboxInCurrentFilter(CompositeFilterDescriptor filterDescriptor, string size)
{
// get all current filter descriptors and evaluate whether to select the current checkbox
// the default value for string filter descriptors is null so it would select the null checkbox always
// so we will add a check to ensure it matches the desired operator - IsNull (see the UpdateCheckedSizes method below)
if (size == null)
{
foreach (FilterDescriptor item in filterDescriptor.FilterDescriptors)
{
if(item.Operator == FilterOperator.IsNull)
{
return true;
}
}
return false;
}
return filterDescriptor.FilterDescriptors.Select(f => (f as FilterDescriptor).Value?.ToString()).ToList().Contains(size);
}
public void UpdateCheckedSizes(bool value, string itemValue)
{
// update the list of items we want to filter by
var isSizeChecked = CheckedSizes.Contains(itemValue);
if (value && !isSizeChecked)
{
CheckedSizes.Add(itemValue);
}
if (!value && isSizeChecked)
{
CheckedSizes.Remove(itemValue);
}
// prepare filter descriptor
var filterDescriptor = theFilterContext.FilterDescriptor;
filterDescriptor.FilterDescriptors.Clear();
// use the OR logical operator so we include all possible values
filterDescriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
CheckedSizes.ForEach(s => {
// instantiate a filter descriptor for the desired field, and with the desired operator and value
FilterDescriptor fd = new FilterDescriptor("Size", FilterOperator.IsEqualTo, s);
// set its type to the field type you filter (the Size field in this example)
fd.MemberType = typeof(string);
// handle null values - use a specific filter operator that the user cannot select on their own
// in this custom filter template (the grid has it in a dropdown by default)
if(s == null)
{
fd.Operator = FilterOperator.IsNull;
}
filterDescriptor.FilterDescriptors.Add(fd);
});
//ensure there is at least one blank filter to avoid null reference exceptions
if (!filterDescriptor.FilterDescriptors.Any())
{
filterDescriptor.FilterDescriptors.Add(new FilterDescriptor());
}
}
// sample grid data
public List<SampleData> GridData { get; set; }
protected override void OnInitialized()
{
GridData = Enumerable.Range(1, 70).Select(x => new SampleData
{
Id = x,
Size = Sizes[x % Sizes.Length],
ProductName = $"Product {x}"
}).ToList();
base.OnInitialized();
}
public class SampleData
{
public int Id { get; set; }
public string Size { get; set; }
public string ProductName { get; set; }
}
public string[] Sizes = new string[] { "XS", "S", "M", "L", "XL", null };
}
Hello.
When using the editor at the present time, the problem arises in that you cannot insert a picture from a local computer, but you need to download it somewhere, and then insert the url's image.
Will the system be improved to upload pictures from the local computer or use drag and drop?
(copy/paste no work perfectly u can't upload image with big size)
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
При использовании редактора в настоящее время, возникает проблема в том что нельзя вставить картинку с локального компьютера, а необходимо загрузить куда то, а потом вставить урл.
Будет ли доработана система, что можно будет загружать картинки с локального компьютера и использовать драг/дроп?
Hello.
I wanted to know how I can modify the WizardStepper template? Basically I want to customize the WizardStepper in a similar way to when it is customized in the Stepper component (https://docs.telerik.com/blazor-ui/components/stepper/step-template).
Since the WizardStepper is actually a Stepper, I suppose this is possible. The point is that I have not managed to do it. I'd tried WizardStepperSettings but only two properties can be configured from here (StepType and Linear).
Thanks.
Hello,
I was wondering if/when you will offer a larger selection of themes for your Blazor components?
Other vendors, e.g. DevExpress, have large theme selections, as seen here https://demos.devexpress.com/blazor/GridColumnTypes
Right now, you only have three, which are very similar to one another. Users commonly want to have a dark theme, for example, and you don't offer any.
Please advise.
Thank you.I have a wizard where I have defined OnChange events for the steps and I am also creating my own custom buttons.
the event fires when a step is clicked on in the progress bar, but they do not fire when clicking on the buttons in the WizardButtons.
I have created my next and previous button just like in your example for custom buttons.
if (index > 0)
{
<TelerikButton ButtonType="ButtonType.Button" OnClick="@(() => step -= 1)">Previous</TelerikButton>
}
if (index < lastStep)
{
<TelerikButton ButtonType="ButtonType.Button" OnClick="@(() => step += 1)" Primary="true">Next</TelerikButton>
}
Hi,
I have a Treelist filled with items + plus another textbox control. The contents of these controls are just different views of the same list of fields. As I move my mouse over the treelist, I'd like a mousemove event to fire so I can highlight the equivalent item in my textbox.
How do I get a mouseover event to call my underlying C# code with the current mouse over row?
Note, I currently have a column template with mousemove event in it. That works, but requires very specific mouse locations. I'd like it to be a full row trigger (just like your current mouseover highlighting). I'd really prefer not to use a row template either as I want all the cool functionality you provide without it (expand/collapse, edit etc). Is this possible?
I'm from a wpf background and love the idea of making web-based apps that can provide rich experiences to my users. I'm really hoping that Blazor grant me this opportunity.
Cheers
Hello!
Consider the code bellow. I have an @ondblclick event on a card that sets a boolean value which in turns controls the visible property of a Telerik RTE inside a foreach loop.
The problem is when I double click on card, all the RTEs become visible. How can I control the dblclick event to set the Visible property of the RTE inside the card I dblclick? Any hint will do.
I dont know if I am making any sense, but I can provide additional details if needed.
@foreach (var chapters in leaseContractDefaultTemplateChapters.OrderBy(s => s.DisplayOrder))
{
<MudContainer Fixed="true">
<MudPaper Height="auto" Width="auto">
<MudCard @ondblclick="@OnChapterCardDoubleClick">
<MudCardHeader>
<CardHeaderContent>
<MudText Class="d-flex" Typo="Typo.h6">@chapters.Name</MudText>
</CardHeaderContent>
<CardHeaderActions>
<MudIconButton OnClick="@(async () => await GetComputedTemplateChapter())" Icon="@Icons.Material.Outlined.Functions" />
<MudIconButton OnClick="@OnSaveChapterClick" Icon="@Icons.Material.Filled.Save" Color="Color.Success" />
</CardHeaderActions>
</MudCardHeader>
<MudCardContent>
@if (rteVisible)
{
<TelerikEditor @ref="chapterEditor" @bind-Value="@chapters.HtmlString"
Tools="@Tools"
Height="300px">
</TelerikEditor>
}
else
{
@((MarkupString)chapters.HtmlString)
}
</MudCardContent>
</MudCard>
</MudPaper>
</MudContainer>
}