Hello! When I try to populate a grid with data I can only get it to show the data if I don't use a nested object. For example:
An object like this I'd assume I could access by adding a grid column like this:
When I do it this way however nothing shows up although all items do load into the grid, they just don't show any text.
To make it show text I can only use the first level of properties in the object:
In this case I'd see the data in this property on the table.
Is this a bug or intended functionality?
@inherits LayoutComponentBase
<TelerikMediaQuery Media="(max-width: 560px)" OnChange="@SmallMediaQueryChange"></TelerikMediaQuery>
<TelerikMediaQuery Media="(min-width: 560px) and (max-width: 828px)" OnChange="@MediumMediaQueryChange"></TelerikMediaQuery>
@* break point intended for 768px, however, the demo has two paddings 30px each that lead to the new 828px break point *@
<TelerikMediaQuery Media="(min-width: 828px)" OnChange="@LargeMediaQueryChange"></TelerikMediaQuery>
<div class="demo-menu-container">
@{
if (WindowSize == DemoWindowSize.Large)
{
<a href="https://www.nmrk.com/services/valuation-and-advisory">
<img src="https://www.nmrk.com/favicons/favicon-32x32.png" sizes="32x32" />
</a>
}
else
{
if (IsDrawerOpen)
{
<TelerikButton OnClick="(() => IsDrawerOpen = false)" Icon="@SvgIcon.X" FillMode="@(ThemeConstants.Button.FillMode.Flat)"></TelerikButton>
}
else
{
<TelerikButton OnClick="@ToggleDrawer" Icon="@SvgIcon.Menu" FillMode="@(ThemeConstants.Button.FillMode.Flat)"></TelerikButton>
}
}
}
@*<h2 class="tk-title">NEWHAL</h2>*@
<span class="separator"></span>
@{
if (WindowSize == DemoWindowSize.Large)
{
<TelerikMenu Data="@MenuItems" CloseOnClick="true" OnClick="@((MenuItem item) => OnMenuItemClick(item))">
<ItemTemplate Context="item">
<span class="k-menu-link-text @(item.Text.ToLower() != "components" ? "k-font-weight-bold" : "")">@item.Text</span>
</ItemTemplate>
</TelerikMenu>
}
}
</div>
<TelerikDrawer @ref="@Drawer" Class="@DrawerClass" Data="DrawerItems" @bind-Expanded="IsDrawerOpen" Mode="@DrawerMode.Overlay">
<Template>
<div class="k-drawer-items" role="menubar" aria-orientation="vertical">
<ul>
@foreach (var item in context)
{
var selectedClass = item == SelectedMenuItem ? "k-selected" : string.Empty;
var boldClass = item.Text.ToLower() != "components" ? "k-font-weight-bold" : "";
if (item.Level == 0)
{
<li class="k-drawer-item k-drawer-separator"></li>
}
<li @onclick="@(() => OnItemSelect(item))" class="k-drawer-item @selectedClass k-level-@(item.Level)">
@if (item.Expanded && (item.Items?.Any() ?? false))
{
<TelerikSvgIcon Icon="@SvgIcon.ChevronUp"/>
}
else if (!item.Expanded && (item.Items?.Any() ?? false))
{
<TelerikSvgIcon Icon="@SvgIcon.ChevronDown" />
}
<span class="k-item-text @boldClass">@item.Text</span>
</li>
}
</ul>
</div>
</Template>
<DrawerContent>
@((MarkupString)DrawerContent)
</DrawerContent>
</TelerikDrawer>
@Body
@code {
public bool IsDrawerOpen { get; set; } = false;
public string DrawerClass { get; set; }
public string DrawerContent { get; set; }
public MenuItem SelectedMenuItem { get; set; }
public DemoWindowSize WindowSize { get; set; }
public TelerikDrawer<MenuItem> Drawer { get; set; }
public List<MenuItem> MenuItems { get; set; }
public List<MenuItem> DrawerItems { get; set; }
public class MenuItem
{
public string Text { get; set; }
public string Url { get; set; }
public bool Expanded { get; set; }
public int Level { get; set; }
public List<MenuItem> Items { get; set; }
public string Content { get; set; }
}
public enum DemoWindowSize
{
Small,
Medium,
Large
}
private void UpdateDrawerContent(string content)
{
if (!string.IsNullOrEmpty(content))
{
DrawerContent = content;
}
}
protected void OnMenuItemClick(MenuItem item)
{
UpdateDrawerContent(item.Content);
}
public async Task ToggleDrawer()
{
await Drawer.ToggleAsync();
}
public async Task OnItemSelect(MenuItem selectedItem)
{
SelectedMenuItem = selectedItem;
UpdateDrawerContent(selectedItem.Content);
selectedItem.Expanded = !selectedItem.Expanded;
var newData = new List<MenuItem>();
foreach (var item in DrawerItems.Where(x => x.Level <= selectedItem.Level))
{
newData.Add(item);
if (item == selectedItem && selectedItem.Expanded && (item.Items?.Any() ?? false))
{
foreach (var child in item.Items)
{
newData.Add(child);
}
}
if (item != selectedItem && !(item.Items?.Contains(selectedItem) ?? false))
{
item.Expanded = false;
}
}
DrawerItems = newData;
if (selectedItem.Level != 0)
{
await ToggleDrawer();
}
await Task.Yield();
}
public void SmallMediaQueryChange(bool matchesMediaQuery)
{
if (matchesMediaQuery)
{
WindowSize = DemoWindowSize.Small;
DrawerClass = "drawer-sm";
}
}
public void MediumMediaQueryChange(bool matchesMediaQuery)
{
if (matchesMediaQuery)
{
WindowSize = DemoWindowSize.Medium;
DrawerClass = "";
}
}
public async Task LargeMediaQueryChange(bool matchesMediaQuery)
{
if (matchesMediaQuery)
{
WindowSize = DemoWindowSize.Large;
DrawerClass = "";
if (IsDrawerOpen)
{
await Drawer.ToggleAsync();
}
}
}
protected override void OnInitialized()
{
MenuItems = new List<MenuItem>()
{
new MenuItem()
{
Text = "Bids",
Expanded = false,
Level = 0,
},
new MenuItem()
{
Text = "Assignments",
Level = 0,
},
new MenuItem()
{
Text = "Jobs",
Level = 0,
Url = "/jobs"
},
new MenuItem()
{
Text = "Comps",
Level = 0,
},
new MenuItem()
{
Text = "Production",
Level = 0,
},
new MenuItem()
{
Text = "Templates",
Level = 0,
},
new MenuItem()
{
Text = "Administration",
Level = 0, }
};
DrawerContent = MenuItems[0].Content;
DrawerItems = MenuItems;
base.OnInitialized();
}
}
<style>
.k-menu-link
{
color: rgb(18, 116, 172) !important;
}
#demo-runner {
padding: 0px;
}
.drawer-sm.k-drawer-expanded .k-drawer.telerik-blazor {
width: 100%;
}
.drawer-sm.k-drawer-expanded .k-drawer-wrapper,
.drawer-sm.k-drawer-expanded .k-drawer-items {
width: 100% !important;
}
.drawer-sm.k-drawer-expanded .k-drawer {
max-width: 100vh;
}
.drawer-sm.k-drawer-expanded .k-overlay {
display: none;
}
.k-drawer-container {
position: relative;
width: 100%;
height: 95%;
min-height: 300px;
}
.k-drawer-container .k-drawer-content {
font-size: 16px;
line-height: 20px;
}
.k-drawer-container.k-drawer-overlay .k-drawer {
position: absolute;
}
.k-drawer-content {
padding: 25px;
font-size: 18px;
}
.k-drawer-content a {
color: #3D57D8;
text-decoration: inherit;
}
.k-drawer-content a:hover {
text-decoration: underline;
}
.k-drawer-content h2 {
font-weight: 300;
}
.tk-logo,
.tk-logo svg {
height: 19px;
width: 18px;
}
.tk-logo {
margin: 5px;
}
.tk-title {
font-size: 19px;
font-weight: 400;
white-space: nowrap;
overflow: hidden;
}
.separator {
box-sizing: border-box;
width: 1px;
height: 20px;
background: #E5E5E5;
border-radius: 0px;
}
.demo-menu-container {
height: 48px;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
padding: 0px 8px;
gap: 8px;
height: 48px;
left: 0px;
top: 0px;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.03), 0px 4px 5px rgba(0, 0, 0, 0.04);
}
.demo-menu-container figure {
width: 19px;
height: 19px;
margin: 0 5px 0 0;
}
.demo-menu-container .k-menu {
height: 100%;
}
.k-drawer-item.k-level-1 {
padding-inline-start: 60px;
}
.k-overlay {
position: absolute;
}
</style>
Jobs.razor
@layout __Main
Where I've embedded the REPL I seem to be getting errors today.
Any changes your side?
Hi,
It would be great if I could drag a file and have it add to my blazorrepl form as a new attachment. Would save time vs adding files manually then cutting and copying the contents.
Peter
Hi,
I've used the REPL embed feature to include some examples in my online Blazor course (running via WASM).
This week I've had a few reports of the REPL not loading correctly for people.
It seems to be fine for me, but here's an example of an error one person ran into:
Any ideas?
Thanks
REPL for aspnet core notifications is broken, it runs on first load and then fails to do anything if I change even a single character and then try to run it again
ASP.NET Core REPL - ASP.NET Core Components Playground & Testing - Telerik
Not sure that link will work but I'm talking about the notification that shows email message, error message and upload success
I'm seeing message in dev tools about 'isMobile is not defined'
Running in Windows 10, latest version of Edge OR latest version of Chrome
REPL currently provides the option to add external static assets. However, one might need to create their own JavaScript and CSS files.
We want to track the community's interest in allowing users to add .css and .js files inside the projects and use them from the .razor files. Please add your vote if this is a feature you'd like us to add to the REPL tool.
We are researching if hot reload can be used in REPL and whether it will affect its performance.
We want to evaluate the community's interest and feedback in this regard. Please vote for this item if you'd like us to add a hot reload feature. Please also share your thoughts on whether it should be enabled by default or if you'd prefer to have the ability to toggle it when needed.
We are researching possible options for adding an autocomplete feature for the REPL Editor.
We want to evaluate the community's interest and feedback in this regard. Please vote for this item if you'd like us to add autocomplete feature and share your thoughts and expectations considering the following possible options:
At this point, we provide only compile-time errors in the Error List. The runtime errors are not caught and they are going directly into the browser console.
We want to track the community's interest in having a console for runtime errors. Please add your vote if this is a feature you'd like us to add to the REPL tool.
Existing REPLs do not compile and run any more.
Here is one simple example. and the error messages you get when you try to save/run
Telerik REPL for Blazor - The best place to play, experiment, share & learn using Blazor.
CS0246 | The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) | __Main.razor | 22 |
CS0246 | The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) | __Main.razor | 23 |
CS0246 | The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) | __Main.razor | 24 |
CS0246 | The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) | Comp1.razor | 23 |
CS0246 | The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) | Comp1.razor | 24 |
CS0246 | The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?) |
Hey,
If the plan is to encourage more widespread use of the REPL, promoting its role as a "go to" destination to prototype and share Blazor code, I wonder if there's scope for an option to toggle Telerik UI off.
I mean, I get why you'd want that on by default…
But I'm keen to use the REPL to embed "runnable" examples in blog posts and often need to share examples that use plain old CSS, or something like Tailwind (or indeed Bootstrap).
In those scenarios I don't really need the default theme/styles that come with Telerik UI (and they could clash with the styles I am trying to use).
Just a thought :)
https://blazorrepl.telerik.com/GQYpbvbP37ENDltY58
This sample seems to be broken. It won't run.
I sometimes have a few repl tabs open to compare results. At the end when I am satisfied I often need just one, and closing the others in bulk is quite annoying as I keep getting interrupted by the window.oneforeunload prompt.
This setting should be somewhere in the UI and should save in the browser local storage so all my repl tabs can use it from the same place. I would prefer that over a cookie or non-persistent setting.