I'm still new to these components, but when any On***Click event is fired on the Grid, when using GridScrollMode.Virtual, the Grid scrolls back to top. This only happens when using virtual scrolling. I don't know if the Grid is rerendered or just scrolls up, it's hard to know.
Feels like a bug, as it works well when not using virtual scrolling. I've tried setting the args.ShouldRender = false, without any luck.
When I create a form with auto-generated fields and disable one of them (see code), the field indeed cannot be edited, but the associated spinner remains active (is a numeric field in this case), allowing the modification of the field's value. I believe that the underlying editor of the field (regardless of its type: datepicker, combobox, dropdownlist, numerictextbox or colorpicker) should be disabled when the FormItem is disabled, as it creates inconsistencies in the UI.
<FormItems>
<FormItem Field="@nameof(ViewModel.SomeField)" />
<FormItem Field="@nameof(ViewModel.NumericField)" Enabled="@some_variable"/>
</FormItems>
As the title says, I am trying to use the @onkeydown Event in a TreeView ItemTamplate.
The reason for doing this is so I can manipulate the default navigation behaviour of the TreeView and immediately select an item when using the Up and Down Arrows instead of having to press the Enter key.
I am aware of the documentation that shows how to react to @onclick Blazor Treeview - Templates - Telerik UI for Blazor.
I can get @onclick to work but not @onkeydown or any other input related events besides mouse events.
Using Telerik 3.6.0
Below is a code sample which shows what I am trying to do but is not working.
When debugging and setting a breakpoint in the NodeKeyDown Method, I can not reach it.
<TelerikTreeView Data=“@TreeData”><TreeViewBindings><TreeViewBinding><ItemTemplate> @{ TreeItem itm = context as TreeItem;
<span @onkeydown=“@(_ => NodeKeyDown(_))” tabindex=“0”> Node: <strong>@itm.Text</strong></span>
}
</ItemTemplate>
</TreeViewBinding>
</TreeViewBindings>
</TelerikTreeView>
<label id=“result”>@result</label>
@code { string result { get; set; }
async Task NodeKeyDown(KeyboardEventArgs args)
{
result = $"You pressed key: {args.Code}";
}
// sample data
public IEnumerable<TreeItem> TreeData { get; set; }
public class TreeItem
{
public string Text { get; set; }
public int Id { get; set; }
public List<TreeItem> Items { get; set; } = new List<TreeItem>();
public bool HasChildren { get; set; }
}
protected override void OnInitialized()
{
LoadHierarchical();
}
private void LoadHierarchical()
{
List<TreeItem> roots = new List<TreeItem>()
{
new TreeItem { Text = "Item 1", Id = 1, HasChildren = true },
new TreeItem { Text = "Item 2", Id = 2, HasChildren = true }
};
roots[0].Items.Add(new TreeItem { Text = "Item 1 first child", Id = 3 });
roots[0].Items.Add(new TreeItem { Text = "Item 1 second child", Id = 4 });
roots[1].Items.Add(new TreeItem { Text = "Item 2 first child", Id = 5 });
roots[1].Items.Add(new TreeItem { Text = "Item 2 second child", Id = 6 });
TreeData = roots;
}
Between the Signature Component and the PDF Processing component I'm having a hard time figuring out how to present a pdf file on a Blazor page for the user to read. Then have a user provide their signature and save that file with the signature imbedded.
I feel like I'm missing and or confusing steps here.. Can someone help me out?
@using [***].Common.Dtos;
@using [***].Common.Enumerations;
@using [***].Features.EmployeeInfoAndTravelRequestLists.TravelRequestListingTab
@if (ViewModel is not null)
{
<!-- Render loader until grid initial data load is complete -->
@if(!ShouldRenderGrid)
{
{
<div style="height:500px">
<TelerikLoaderContainer></TelerikLoaderContainer>
</div>
}
} else
{
<TelerikGrid OnRead="@TravelRequestGridOnReadAsync"
Class="grid-no-scroll"
TItem="@TravelRequestFullDto"
EnableLoaderContainer="true"
Pageable="true"
Sortable="true"
SortMode="SortMode.Multiple"
PageSize="10"
SelectionMode="@GridSelectionMode.Single"
FilterMode="GridFilterMode.FilterMenu">
<!-- dropdown, search box and new request button above grid -->
<GridToolBarTemplate>
<div class="dropdown-list-container">
<TelerikDropDownList Width="100px" Data="@ViewModel.EmployeeStatuses" @bind-Value="ViewModel.EmployeeStatusDDLSelectedValue">
<DropDownListSettings>
<DropDownListPopupSettings Height="58px" />
</DropDownListSettings>
</TelerikDropDownList>
</div>
<GridSearchBox Placeholder="Name/SAP/Personal ID..."
Width="280px" />
<button class="new-request-button"><span class="k-icon k-i-plus"></span>New Request</button>
</GridToolBarTemplate>
<GridColumns>
<GridCheckboxColumn SelectAll="false" Width="40px" />
<GridColumn Title="SAP Number" Width="195px">
<Template>
@{
var SAPNumber = ((TravelRequestFullDto)context).SAPNumber;
var RequestStatus = ((TravelRequestFullDto)context).Status;
// render a chip in travel request number column if record has a request status
<span>
@SAPNumber
<span class="cell-padding" />
<TelerikChip Class="travel-request-status-chip"
Text=@TravelRequestStatusExtensions.ToDisplayValue(RequestStatus)
Disabled=true
Rounded="full"
ThemeColor=@GetChipColorClass(RequestStatus) />
</span>
}
</Template>
</GridColumn>
<GridColumn Title="Workday Number" Field="@(nameof(TravelRequestFullDto.WorkdayNumber))" Width="140px" />
<!-- other grid columns here.... -->
</GridColumns>
</TelerikGrid>
}
}
I am starting a new project and went to download the latest version of Blazor from nuget and I get the following error:
GET https://nuget.telerik.com/v3/package/telerik.fonticons/index.json
GET https://nuget.telerik.com/v3/package/telerik.svgicons/index.json
OK https://nuget.telerik.com/v3/package/telerik.fonticons/index.json 6039ms
OK https://nuget.telerik.com/v3/package/telerik.svgicons/index.json 6037ms
NU1101: Unable to find package Telerik.FontIcons.
NU1101: Unable to find package Telerik.SvgIcons.
Package restore failed.
The last version I can successfully download is Telerik.UI.for.Blazor 4.4.0. Everything after that seems to have an issue with the icon dependencies.
Anyone have any thoughts on what I might be missing, has anyone else been able to successfully start a new project with 4.5.0 or higher?
Some important background first. There is a lot to share but its important because you'll have a lot of question about why I'm doing some things.
My model is a single, self-referencing table holding hierarchical data. I have three fields: "TaxonomyId", "Name", "ParentId". Taxonomy Id is my ValueField and Name is the TextField. Currently the hierarchy is limited to 5 levels. The previous dropdown filters the next based on the selection. Names are unique in a single hierarchy but not across hierarchies. Clear as mud? LOL
I have separate Lists I use as models for each of the dropdown lists to be cascading through the single hierarchy. I can't use a single table model because each dropdown uses the same model. It appears to overwrite the previous selection and I need to keep track of all the selections. Those lists are bound to each ddl to display the list of Names.
So, to make the dropdowns cascade, I call my GetNextLevel() method for the OnChange() event. I tried ValueChange() but firing on every keystroke seemed to cause some UI performance issues. May have just been my ignorance. Anyway, I pass the level (1-5) and the bound value (Name) to get the next ddl values. All this works perfect.
Now to the ask. I'm trying to get the ValueField (TaxonomyId) and pass it to GetNextLevel(). I can pass the event args but that only gives me the selected value and I also need the level (which ddl was clicked). If I could send level and the ValueField I would be "golden".
Now the code. Here are my ddls
<div><TelerikFloatingLabel Text="Level 1"><TelerikComboBox Class="justification" AllowCustom="true" Data="@L1" ClearButton="false" TextField="Name" ValueField="TaxonomyId" @bind-Value=@L1Value OnChange="@(GetNextLevelTest)"></TelerikComboBox></TelerikFloatingLabel></div>
@if (!String.IsNullOrEmpty(L1Value))
{
<div><TelerikFloatingLabel Text="Level 2"><TelerikComboBox Class="justification" @ref="TestRef" id="L2" AllowCustom="true" Data="@L2" ClearButton="false" TextField="Name" ValueField="TaxonomyId" @bind-Value=@L2Value OnChange="@(() => GetNextLevel(L2Value, 2))"></TelerikComboBox></TelerikFloatingLabel></div>
}
@if (!String.IsNullOrEmpty(L2Value))
{
<div><TelerikFloatingLabel Text="Level 3"><TelerikComboBox Class="justification" Data="@L3" AllowCustom="true" TextField="Name" ClearButton=false ValueField="TaxonomyId" @bind-Value="@L3Value" OnChange="@(() => GetNextLevel(L3Value, 3))"></TelerikComboBox></TelerikFloatingLabel></div>
}
@if (!String.IsNullOrEmpty(L3Value))
{
<div><TelerikFloatingLabel Text="Level 4"><TelerikComboBox Class="justification" Data="@L4" AllowCustom="true" TextField="Name" ClearButton=false ValueField="TaxonomyId" @bind-Value="@L4Value" OnChange="@(() => GetNextLevel(L4Value, 4))"></TelerikComboBox></TelerikFloatingLabel></div>
}
@if (!String.IsNullOrEmpty(L4Value))
{
<div><TelerikFloatingLabel Text="Level 5"><TelerikComboBox Class="justification" Data="@L5" AllowCustom="true" ClearButton="false" TextField="Name" ValueField="TaxonomyId" @bind-Value="@L5Value" OnChange="@(() => GetNextLevel(L5Value, 5))"></TelerikComboBox></TelerikFloatingLabel></div>
}
Here is the GetNextLevel method. This is more for your edification as I don't think it will impact the answer? A lot of this code is validation if a user goes back up the list and chooses another value or selects the same value.
/// <summary>
/// Populates a change ddl based on the parent id of the previous ddl and adds the selection to a ChangeDetailDTO object.
/// </summary>
/// <param name="selectedValue">This has to be a string because of the ability to edit the selected value</param>
/// <param name="level"></param>
public async Task GetNextLevel(string selectedValue, int level)
{
//Get the appropriate Taxonomy List object
var SelectedLevels = GetType().GetProperty(DDLGroup+"Levels"??"").GetValue(this,null) as List<TaxonomyDdlDTO>;
//if this is replacing a level that is last in the index, remove the old value.
//further down I'm clearing a range if a new dd value is selected to remove all the child values
if (string.IsNullOrEmpty(selectedValue))
return;
//if the selected value is not changed, do nothing.
if (level <= SelectedLevels!.Count())
{
if (selectedValue == SelectedLevels[level-1].TaxonomyId)
return;
}
int selectedId = 0;
int.TryParse(selectedValue, out selectedId);
//Parent int of 0 means its a top-level item
if (selectedId != 0)
{
var currentLevel = TaxonomyList.Where(x => x.TaxonomyId == selectedValue).Single();
if (!SelectedLevels.Contains(currentLevel))
{
SelectedLevels.Add(currentLevel);
};
}
else
{
if (SelectedLevels.Count <= level-1 && SelectedLevels[level - 2] != null)
SelectedLevels.RemoveAt(level - 2);
SelectedLevels.Add(new TaxonomyDdlDTO()
{
TaxonomyId = selectedValue,
Name = selectedValue
});
}
//Event passes the new selection object to the parent page
if(DDLGroup == "Current")
await CurrentLevelSelectedEvent.InvokeAsync(SelectedLevels);
else
await NewLevelSelectedEvent.InvokeAsync(SelectedLevels);
//populates the next dropdown list based on the selection justmade
var nextLevelTaxonomy = TaxonomyList.Where(x => x.ParentId == selectedId).ToList();
//Level5 has no children.
if (level <= 4)
GetType().GetProperty(string.Concat("L", level + 1)).SetValue(this, nextLevelTaxonomy);
if (SelectedLevels.Count > level)
SelectedLevels.RemoveRange(level-1, SelectedLevels.Count-1);
}
I appreciate any suggestions you have.
I need to disable the browser's autofill option on our Blazor Autocomplete. How can I accomplish this?
THanks
Billy