Hi, our team is using - https://docs.telerik.com/blazor-ui/components/grid/overview
We are trying to extend the 'GridColumn' control to have show/hide depending on if our user is authenticated, with some role-based things as well.
Where I've gotten to is something like this...
//AuthorizedGridColumn.razor
@typeparam TItem
@if (IsAuthorized)
{
<GridColumn Field="@Field" Title="@Title">
<Template Context="item">
@ChildContent((TItem)item)
</Template>
</GridColumn>
}
@code {
[Inject]
private AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
[Parameter]
publicstring Field { get; set; }
[Parameter]
publicstring Title { get; set; }
[Parameter]
public RenderFragment<TItem> ChildContent { get; set; }
[Parameter]
publicstring PolicyName { get; set; }
privatebool IsAuthorized { get; set; }
protected override async Task OnInitializedAsync()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity == null)
{
IsAuthorized = false;
}
else
{
IsAuthorized = user.Identity.IsAuthenticated && user.IsInRole("Admin");
}
await base.OnInitializedAsync();
}
}
With usage that looks like...
<AuthorizedGridColumn TItem="OurClass" Field="@nameof(OurClass.OurProperty)" Title="Something">
<ChildContent Context="binding">
@{
<p>Only Admins!</p>
}
</ChildContent>
</AuthorizedGridColumn>
<AuthorizedGridColumn TItem="OurClass" Field="@nameof(OurClass.OurProperty)" Title="Something">
<ChildContent Context="binding">
@{
<p>Only Admins!</p>
}
</ChildContent>
</AuthorizedGridColumn>
<GridColumn></GridColumn>
<GridColumn></GridColumn>
<AuthorizeView Roles="Admin">
<GridColumn></GridColumn>
</AuthorizeView>
<GridColumn></GridColumn>
<GridColumn></GridColumn>
I just updated from 4.0.1 to 4.4 and it broke my gridlayouts. I'm guessing it may have to do with the dependencies.
How do I updte the items listed below? Will this resolve my issue?
Before Update:
After Update:
Hi,
I am using Kendo blazor component and getting below warning while using all the components. Please see attached screenshot for snippet.
Warning Message : "Found markup element with unexpected name "TelerikGrid". If this is intended to be a component, add a using directive for its namespace"
Can you tell what namespace should I add in razor file to resolve this issue?
--
Thanks,
Yash
HI,
the DragClueField when using Drag&Drop only exists for the Grid right now. Why is this attribute not setable for the TreeView also?
Inside the Themebuilder is an AppBar-Component but I can not find any documentation about it !?
I would like to use it but I do not know how !