Hi,
I'm in the process of implementing a form in a Window component and would like the content to remain present in the DOM between hiding and showing of the window. I noticed that there's a line in the documentation where it states that PersistContent will allow the content of the window to remain in the DOM whenever the window is minimized. I recommend this be extended to the Visibility of the form, not just minimizing, as to create a more coherent approach.
I did come across this post here where it gives a description of how the above is achieved. This is a very inelegant approach as the consumer of the framework has to manually implement stuff which should be provided by the framework. The suggested approach also prevents the developer from opening multiple windows at once, which might be an issue in some cases.
Wè would like to have the Fluent UI style available for Blazor. We are using the Telerik UI controls in a large project werd the UI has to be very similar to the one of Microsoft D365 Customer Service.
Regards, Henk
Hello
I have just received some feedback from a client re. the DateInput -Blazor control whereby they are describing the default behaviour as "strange" - and on having a closer look I tend to agree / believe there to be bugs with this.
Please see video and below notes - let me know if there are any workarounds to these things.
I do see there is an existing bug report which may partially cover these issues (DatePicker loses focus when used as data editor in the Grid and the input date starts with 0 (telerik.com)) , however, it seems this is "unplanned" ?
QA Telerik DateInput:
Entering a date without using the mouse to move focus is quite important for big data-entry in grids where you are tabbing or clicking over from field to field in large quantities.
Cheers
Phil
Horizontal scrolling in the grid works when its width is set to a fixed value (px, rem, etc.). But the h scroll disappear when a percentage is assigned to the width of the grid.
This seems to be a known 'feature' to Telerik:
A sensible behaviour is to have the horizontal scrolling enabled and at the same time being able to set the grid to percentage width.
Based on the example used in this page (https://docs.telerik.com/blazor-ui/components/grid/editing/incell)
i tried to use a component of my own composed by teleriks components in the editor template
@page "/fetchdata"
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@inject IAccessTokenProvider AuthenticationService
@inject NavigationManager Navigation
@inject WeatherForecastDataSource WeatherForecastDataSource
@using Olympus.Artemis.Shared
@attribute [Authorize]
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from the server.</p>
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
<TelerikGrid Data="_data" Height="400px"
Pageable="true" Sortable="true" Groupable="true" EditMode="@GridEditMode.Incell" Navigable="true"
FilterMode="Telerik.Blazor.GridFilterMode.FilterRow" @ref="_grid"
Resizable="true" Reorderable="true">
<GridColumns>
<GridColumn Field=@nameof(TestItem.WeatherForecastID) Title="Position" Width="200px">
<Template Context="item">
@{
var value = ((TestItem)item).WeatherForecastID;
var text = data.Where(x => x.ID == value).Select(x => x.Date).FirstOrDefault();
}
@text
</Template>
<EditorTemplate>
@{
currentItem = context as TestItem;
<Test2 OnChange="@onChange" DataSource="@this.WeatherForecastDataSource" Value="@currentItem.WeatherForecastID"></Test2>
}
</EditorTemplate>
</GridColumn>
</GridColumns>
</TelerikGrid>
</tbody>
</table>
@code {
protected async Task onChange(object o) {
currentItem.WeatherForecastID =(Guid) o;
Console.WriteLine("wrwerwe"+currentItem.WeatherForecastID);
await CloseEditor(currentItem);
}
protected async override Task OnParametersSetAsync()
{
data =await WeatherForecastDataSource.GetDataAsync();
await base.OnParametersSetAsync();
}
public List<WeatherForecast> data = new List<WeatherForecast>();
public TestItem currentItem { get; set; }
TelerikGrid<TestItem> _grid;
DateTime selectedValue { get; set; } = DateTime.Now;
private List<TestItem> _data = new List<TestItem>()
{
new TestItem { MyDate = DateTime.Today, DateName = "Σημερα" ,WeatherForecastID= new Guid("be4f3a98-5fd3-4972-bc49-1c442cdf87dd") ,ID=Guid.NewGuid()},
new TestItem { MyDate =DateTime.Today.AddDays(1), DateName = "Αύριο",WeatherForecastID=new Guid("7fac0c25-653b-4606-afef-19f6e27fc57a"),ID=Guid.NewGuid() },
new TestItem { MyDate =DateTime.Today.AddDays(2), DateName = "Μεθαύριο" ,WeatherForecastID= new Guid("48eb0a12-5971-479a-852d-6383f30e14cb"),ID=Guid.NewGuid()},
new TestItem { MyDate =DateTime.Today.AddDays(3), DateName = "Αντιμεθαύριο" ,WeatherForecastID= new Guid("113bde91-b0b9-45e0-9d4b-5b280650e042"),ID=Guid.NewGuid()}
};
public class TestItem:Olympus.Artemis.Shared.InfoEntities.BaseInfo {
public Guid WeatherForecastID { get; set; }
public DateTime MyDate { get; set; }
public string DateName { get; set; }
public override bool Equals(object obj)
{
if (obj != null && obj is TestItem)
{
TestItem curr = obj as TestItem;
return (ID == curr.ID) && (WeatherForecastID == curr.WeatherForecastID) && (MyDate == curr.MyDate) && (DateName == curr.DateName);
}
return false;
}
}
public async Task CloseEditor(TestItem currentItem)
{
var state = _grid?.GetState();
if (currentItem.ID == null && state.InsertedItem != null)
{
// insert operation - the item is new
await CreateHandler(new GridCommandEventArgs()
{
Item = state.InsertedItem
});
}
else
if (currentItem.ID != null && state.EditItem != null)
{
Console.WriteLine($"field c {state.EditField} {typeof(TestItem).GetProperty(state.EditField).GetValue(currentItem)}");
Console.WriteLine($"field e {state.EditField} {typeof(TestItem).GetProperty(state.EditField).GetValue(state.EditItem)}");
// edit operation on an existing item
await UpdateHandler(new GridCommandEventArgs()
{
Item = state.EditItem,
Field = state.EditField
});
}
state.InsertedItem = state.OriginalEditItem = state.EditItem = default;
StateHasChanged();
await Task.Delay(200); // let the grid re-render and close the cell if keyboard navigation is enabled
await _grid?.SetState(state);
}
async Task UpdateHandler(GridCommandEventArgs args)
{
string fieldName = args.Field;
object newVal = args.Value; // you can cast this, if necessary, according to your model
Console.WriteLine(fieldName);
TestItem item = (TestItem)args.Item; // you can also use the entire model
Console.WriteLine(item.ID);
// perform actual data source operation here through your service
// if the grid Data is not tied to the service, you may need to update the local view data too
var index = _data.FindIndex(i => i.ID == item.ID);
if (index != -1)
{
if (!_data[index].Equals(item))
{
_data[index] = item;
Console.WriteLine("Update event is fired for " + args.Field + typeof(TestItem).GetProperty(args.Field).GetValue(item));
// this copies the entire item, consider altering only the needed field
}
}
}
async Task CreateHandler(GridCommandEventArgs args)
{
TestItem item = (TestItem)args.Item;
item.ID = Guid.NewGuid();
_data.Insert(0, item);
Console.WriteLine("create");
// perform actual data source operation here through your service
}
}
The test2 component created by me is this one It only includes a telerikdropdown
@using Olympus.Artemis.Shared
<TelerikComboBox Data="@Items" Value="@Value" ValueField="ID" OnChange="@OnChange" TextField="Date">
</TelerikComboBox>
@code {
[Parameter]
public EventCallback<Object> OnChange { get; set; }
[Parameter]
public Guid Value { get; set; }
[Parameter]
public DataSource<WeatherForecast> DataSource { get; set; }
private IEnumerable<WeatherForecast> Items { get; set; } = new List<WeatherForecast>();
protected async override Task OnInitializedAsync()
{
Items = await DataSource.GetDataAsync();
await base.OnInitializedAsync();
}
}
But when i try to select something from the dropdown list the grid cel does not close gracefully
I get this error (the problem is when it executed the line await _grid?.SetState(state);)
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
The test control is a simplified version of a more complex control i was trying to create (mutlicolumn combobox)
If I instead use the telerikdropdown in editortemplate everything works ok
Per API documentation, the Decimals property defaults to what is set in the user's region (culture). This is a flawed design.
Why would one think that ALL properties of type double or float in grid models should be truncated to 2 decimal places (when my region is set to US and that is the default)?
This seriously limits property values. Not everything is a dollar and cent value! The region setting I believe is for how to format general currency values perhaps (I am not exactly sure what it is for, because there is a different tab for 'Currency' with a 'No. of digits after decimal' setting as well as the tab for 'Numbers' having the same thing. But this does not mean that Windows always formats numbers that way.
Suppose for example I have a property in my model named "Weight" (expressed in terms of pounds). The value 150.12345 (pounds) is perfectly valid. It should not be truncated to 150.12. Or another, "Length" (expressed in terms of Feet): 17.0625 (that's 17 feet, 1 inch) - should not be morphed into 17.06.
To work around this, developers currently either have to override a <GridColumn>'s <EditorTemplate> and place a <TelerikNumericTextBox> element bound to the same property that the <GridColumn> is, and explictly set the Decimals property themselves.
Or what I have found is a better workaround, although not desirable to have to do this at all, is to put this kind of code snippet in the Program.cs file, right after the line var app = builder.Build();
app.UseRequestLocalization(action =>
{
var currentCulture = CultureInfo.CurrentCulture.Clone() as CultureInfo;
currentCulture!.NumberFormat.NumberDecimalDigits = 10; // for example, to allow this many decimal places in everything numeric
var cultures = new List<CultureInfo>() { currentCulture };
action.SupportedCultures = cultures;
});
Please remove the default value for the Decimals property being tied to the culture. It should just allow as many decimal places as a normal float or double would allow for its precision. Perhaps just allow a developer to set it and honor that, but if not set, basically let it be unlimited, just like the number of digits to the left of the decimal point.
As we are porting many of our applications from Telerik MVC to Blazor, our clients are complaining about particular features no longer being available.
One of which is the multiline edit for incell edit that is available in Telerik-MVC.
This feature is nice as it allows the grid to have a very "excel - like" feel to it, with a small triangle in the corner to indicate the cell/view-model has been edited.
As is, the user is forced to edit the data line-by-line, and save per line.
In real client work, data is not necessarily modified in this linear/per-row fashion.
Take for example, a client has a list of delivery dates which need to be updated down 1 column, current functionality is painful, as you need to edit 1 date, click save, then move onto the next row instead of just moving down the rows and clicking save after you have finished your edits (like you can with Telerik MVC grid).
My rationale for this feature add: The "big data" age is upon us - and blazor is very well suited for these types of applications being strongly typed/c# etc; would be great to see Telerik lead in rich data input components for data heavy applications, and the grid is the most core UI component hence should be the most feature rich and performant.
<TelerikDatePicker Id="startDate" @bind-Value="@StartDate" Width="160px" Format="dd-MMM-yy"></TelerikDatePicker>
DateTime StartDate=DateTime.Now
When our users type to click on the year and type another one they lose one of the digits - so if they try typing 19 or 18 for instance then it sets the date to year 01
Hi,
I had to figure this out myself for the ComboBoxSettings because there is no documentation for this.
The MinWidth works from the Combobox width or greater extending the size of the popup and
MaxWidth only creates a popup width of the Combobox only.
Please document this feature and how to use it. And, is this intentional because it wasn't intuitive for me to figure out.
I created a REPL for you to test this out for yourself.
Hello,
I would love to see an auto sizing for a TileLayoutItem. Specifically, in my case, the RowSpan. I feel like this would make a great addition as a parameter in the future as (also AutoSizeColumn would be nice)
<TileLayoutItem AutoSizeRow="true"></TileLayoutItem>
I am working on an application that has dynamic data displayed within the TileLayoutItem. In my current implementation, I'm going through a process of attempting to calculate for resizing the RowSpan. The calculations are based on an inner body div that holds an id, finds the parent k-tilelayout-item and then the the k-tilelayout itself. I can't positively say my math is perfect but it (mostly) gets the job done. Keeping in mind that I have created other altered other areas of the TileLayout as well, specifically setting the TelerikTileLayout grid to autofit.
For an idea of what I am currently doing as a means of possibly finding a (better) way to implement this in the future, this is the long ugly javascript code I have that is used to gather a minimum size and return it to blazor via JsInterop.
function (tileId, minSpanSize = 4) {
try {
var el = document.getElementById(tileId);
var tileLayout = $(el).closest(".k-tilelayout")[0];
var parentTile = $(el).closest(".k-tilelayout-item")[0];
var headerHeight = $(el).parent().siblings(".k-tilelayout-item-header")[0].offsetHeight;
var parentSpan = parseInt(parentTile.style.gridRowEnd.split("span ")[1]);
var gap = parseInt(tileLayout.style.gap.replace("px", ""));
var rowHeight = parseInt(tileLayout.style.gridAutoRows.split(",")[1].split("px")[0]);
// cannot recall where I got 1.25 from
var minSize = Math.ceil((headerHeight + el.offsetHeight) / ((gap / 1.25) + rowHeight));
// if parent is less than minsize
if (parentSpan < minSize) {
parentTile.style.gridRowEnd = "span " + minSize;
return { id: tileId, minSize: minSize };
// Otherwise, if min size is greater than or equal to minSpanSie
} else if (minSize >= minSpanSize) {
parentTile.style.gridRowEnd = "span " + minSize;
return { id: tileId, minSize: minSize };
}
} catch { }
return { id: tileId, minSize: -1 };
My grid bind to ExpandoObjects, and I would like to implement a Group Header.
So I referenced these two documents
https://docs.telerik.com/blazor-ui/knowledge-base/grid-binding-to-expando-object
https://docs.telerik.com/blazor-ui/components/grid/columns/multi-column-headers
From the first document, it make sense to me that we need to set FieldType for each column that binds to ExpandoObject, but it seems this restriction also applies to the group header column, which does not make sense.
Foe example:
<TelerikGrid Data="@GridData"
Pageable="true"
Sortable="true"
FilterMode="@GridFilterMode.FilterRow">
<GridColumns>
<GridColumn Title="Test Group Header">
<Columns>
<GridColumn Field="PropertyInt" Title="Int Column" FieldType="@typeof(int)" />
<GridColumn Field="PropertyString" Title="String Column" FieldType="@typeof(string)" />
<GridColumn Field="PropertyDate" Title="DateTime Column" FieldType="@typeof(DateTime)" />
</Columns>
</GridColumn>
</GridColumns>
</TelerikGrid>
I get error:
I need to set FieldType on the "Test Group Header" column to an arbitrary value to get rid of this error.
Filter option switch back to default option (Contains) after entering value in the textbox.
Example -
- screenshot-1 - Select from filter option - Startswith ; Then, enter value in text box.
- screenshot -2 - After user enter first character , atomically filter option switch back to Contains (from startswith).
If the Height parameter is not specified, in the Gantt tree list, every line after the number of lines of the initial display are not shown.
The steps are easy to reproduce:
Start from the official Gantt Demo in the REPL and simply remove the Height parameter from TelerikGantt.
If you do this, you will see that opening the children of the first and only element in the tree list will show everything correctly in the Timeline part (if no mistake) but doesn't show the children lines in the TreeList part.
Therefore, I believe, the Height parameter should become mandatory until we can allow the height of the Gantt to be dynamic without rendering issues.
I can't find a way to reliably set focus after a tab change.
In the sample below it first sets focus based on the OnAfterRenderAsync code, but switching to tab 2 and then going back I can't get it to set focus again.
I suspect its because there is no render type of event on a specific tab that I can hook into?
I have tried javascript and blazor and can't seem to figure a way around it.
@page "/test"
<TelerikTabStrip ActiveTabIndex="@TabActiveIndex" Height="87vh" Class="ct-tabstrip" ActiveTabIndexChanged="@TabIndexChanged">
<TabStripTab Title="Orders Search">
<input type="text" @ref=orderSearchTextBox id="test"/>
<br />
<input type="text" />
<br />
<input type="text" />
</TabStripTab>
<TabStripTab Title="Orders Updated Today">
<text>Tab 2</text>
</TabStripTab>
</TelerikTabStrip>
@code {
private ElementReference orderSearchTextBox;
private int TabActiveIndex;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await orderSearchTextBox.FocusAsync();
}
}
public async Task TabIndexChanged(int NewIndex)
{
TabActiveIndex = NewIndex;
if (NewIndex == 0)
{
await orderSearchTextBox.FocusAsync();
}
}
}