Telerik Forums
UI for Blazor Forum
0 answers
1 view

I have a TelerikGrid with paging enabled. The pager on the left hand side displays the page numbers as buttons, and on the right hand side displays the current items being displayed and the total number of items. The problem is that the right-hand side '1 - 1000 of 440000000' does not format the numbers, and for a grid with millions of possible rows reading the exact numbers is difficult.

So I wrote a little javascript to manipulate the dom and format these numbers. In particular I query the document for 'span.k-pager-info' and manipulate the innerText property. This works fine until I filter my grid, at which point it re-fetches data from the db BUT does NOT update that span with the new filtered innerText. In fact, any manipulation with javascript of the 'span.k-page-info' element causes that element to no longer be updated upon filtering data. Why? Is there any other way to format the numbers in the pager so that they display more clearly (ie. 44,000,000)?

Much thanks to all.

Marcin
Top achievements
Rank 1
 asked on 24 Apr 2024
1 answer
14 views

I have the following page:


@page "/test"
@using System.Collections.ObjectModel

<TelerikToolBar Class="toolbar-size" Adaptive="false">    
    <ToolBarButton Icon="@SvgIcon.FileAdd" OnClick="@OnAdd">Add</ToolBarButton>
</TelerikToolBar>

<TelerikSplitter Height="500px">
    <SplitterPanes>
        <SplitterPane Size="20%" Collapsible="true">
            <TelerikTreeView Data="@Items" @bind-CheckedItems="@CheckedItems"                             
                             CheckBoxMode="TreeViewCheckBoxMode.Multiple">
                <TreeViewBindings>
                    <TreeViewBinding ParentIdField="ParentIdValue"></TreeViewBinding>
                </TreeViewBindings>
            </TelerikTreeView>
        </SplitterPane>
        <SplitterPane Collapsible="true">
        </SplitterPane>
    </SplitterPanes>
</TelerikSplitter>

@code {

    public class TreeItem
    {
        public int Id { get; set; }
        public string Text { get; set; }
        public int? ParentIdValue { get; set; }
        public bool HasChildren { get; set; }
        public ISvgIcon Icon { get; set; }
    }

    public ObservableCollection<TreeItem> Items { get; set; } = new ObservableCollection<TreeItem>();
    public IEnumerable<object> CheckedItems { get; set; } = new List<object>();

    private int counter;

    private void OnAdd()
    {
        this.Items.Add(new TreeItem { Id = counter, Text = $"test {counter}" });
        counter++;
    }
}

If I add some items with the add button, then check some items, and then add some more items, the check state seems to be lost.

However, if I collapse and expand the split panel, the items get checked again.

Is this a bug, or what am I doing wrong?

Hristian Stefanov
Telerik team
 answered on 24 Apr 2024
1 answer
10 views
I think I may have posted this question perhaps incorrectly in Technical Support, but let's try here anyways.

I have data I display in a grid that get's re-fetched from the server every second. In Microsoft's QuickGrid, there is an ItemKey attribute that lets you specify a row entries Key so that Blazor can perform it's diff operation more effectively:
<QuickGrid Items="@_Items" ItemKey="(item) => item.Guid" Theme="">
I'm now wanting to switch the QuickGrid out with Telerik's Grid, but can't seem to find any mention of this feature. Does Telerik provide the ability to specify a row's key (so as to improve blazor's diffing algorithm) and if not what is recommended for scenarios where the grid's data is to be re-fetched every second?

Much thanks

Marcin
Dimo
Telerik team
 answered on 24 Apr 2024
0 answers
2 views

Here is my sample. 

https://blazorrepl.telerik.com/wIYIwokW39rcHMFE31

Can you help please?

Glendys
Top achievements
Rank 1
Iron
 asked on 24 Apr 2024
0 answers
2 views
Other providers seem to have the ability to allow shape files on their map components but I only see GeoJson examples on your map component. Do you have examples of how to display shape files on your map (shp, dbf, prj, sbn, sbx, shx) or is that not possible?
Andrew
Top achievements
Rank 1
 asked on 23 Apr 2024
0 answers
2 views

Is it possible to have the panel bar expand or collapsed based on a property (bool IsExpanded) for the list of items in the data property of the panel bar, instead of as a separate list of items bound to the ExpandedItems list of objects?

I have a separate component with expand and collapse buttons.  I have a global list of objects that are in a service.  The Data property of the panel bar is set to this list of global items.  When the Expand All button of the separate component is clicked, it sends a message to the application service to set an Expand for all items in the global list that is bound to the panel bar.  The service sends out a notifystatechanged event.  The problem is I do not want to maintain a completely separate list of objects just for which ones are in the ExpandedItems list.  Would be nice to simply bind the expanded to a property of the global object thereby having the statechanged change the expanding and collapsing of the items in the panel bar.

Is this possible?  Haven't seen anything in documentation that seems to allow this.

Right now it means that my application wide service needs to have a completely separate list of objects for the expanded items in this one panel bar component, so it can add and remove objects and then notifystatechanged back to the panel bar component.

If not, is there any other way of doing this to have the panel bar get notified so it can then add and remove the expanded items object list?

Please advise

Thanks

Eric
Top achievements
Rank 1
 updated question on 23 Apr 2024
0 answers
3 views

I need to format and highlight xml and json in a view. I can not find a component within Blazor components. In other packages like WinForm there are solutions for displaying code. Any way I'm able to do this without clientside javascript solutions (like PrismJS)?

In case there is no component in the Telerik family I can use in Blazor, does anyone have a recommended setup to implement the functionality. A requirement is support for dark/light theming.

Thanks for any insights.

E
Top achievements
Rank 1
 asked on 23 Apr 2024
1 answer
10 views
Start app that has the dropdown component
click on the dropdown and select one of the options
Note: only changes after 6+ clicks
Actual result:

The specific option isn't opened.

 

<FilterComponent @ref="filterComponent" SelectedItem="selectedItem" SelectedItemChanged="UpdateSelectedItemAsync">

 <TelerikStackLayout Orientation="StackLayoutOrientation.Horizontal" HorizontalAlign="StackLayoutHorizontalAlign.Right"
                     VerticalAlign="StackLayoutVerticalAlign.Center" Spacing="5px">
     <TelerikDropDownButton Icon="FontIcon.MoreHorizontal" ThemeColor="@ThemeConstants.Button.ThemeColor.Secondary">
         <DropDownButtonContent>
             Reports
         </DropDownButtonContent>
         <DropDownButtonItems>
             <DropDownButtonItem Icon="FontIcon.Table" OnClick="NavigateToReport1Async">Report 1</DropDownButtonItem>
             <DropDownButtonItem Icon="FontIcon.Table" OnClick="NavigateToReport2Async">Report 2</DropDownButtonItem>
             <DropDownButtonItem Icon="FontIcon.Table" OnClick="NavigateToReport3Async">Report 3</DropDownButtonItem>
         </DropDownButtonItems>
     </TelerikDropDownButton>
     <TelerikButton Icon="FontIcon.ChangeManually" ThemeColor="@ThemeConstants.Button.ThemeColor.Secondary"
                    OnClick="NavigateToCardAsync">Card</TelerikButton>
 </TelerikStackLayout>
</FilterComponent>
Svetoslav Dimitrov
Telerik team
 answered on 23 Apr 2024
1 answer
9 views
I have been searching thru the forum and online and cannot figure out how to set the TelerikListView component to display the items in the itemtemplate horizontally.  I see there is a ListViewSettings but I can't find any documenation on what to put into the settings.
Hristian Stefanov
Telerik team
 answered on 19 Apr 2024
1 answer
8 views

I have the below code that I was  hoping would show the hint above the {getting Started] drawer item when user puts mouse over it.

But to no hope. :( didnt work.

What am I doing wrong?

<TelerikTooltip TargetSelector=".k-drawer-items span.icon-container[title]" />
<TelerikDrawer @ref="@Drawer" Data="Data" MiniMode="false" Mode="@DrawerMode.Push" TItem="DrawerItem" SelectedItemChanged="@OnItemSelect" @bind-Expanded="@Expanded">  
    <Template>
        <div class="k-drawer-items" role="menubar" aria-orientation="vertical">
            <ul>
                @foreach (var item in context)
                {                   
                    var selectedClass = item == SelectedItem ? "k-selected" : string.Empty;
                    <li @onclick="@(() => OnItemSelect(item))" class="k-drawer-item @selectedClass k-level-@(item.Level)">
                        <TelerikSvgIcon Icon="@item.Icon"></TelerikSvgIcon>
                        <span class="icon-container" title="@item.Title"></span>
                        <span class="k-item-text">@item.Text</span>
                        @if (item.Expanded && (item.Children?.Any() ?? false))
                        {
                            <TelerikSvgIcon Class="drawer-chevron-icon" Icon="@SvgIcon.ChevronDown"/>
                        }
                        else if (!item.Expanded && (item.Children?.Any() ?? false))
                        {
                            <TelerikSvgIcon Class="drawer-chevron-icon" Icon="@SvgIcon.ChevronRight" />
                        }
                    </li>
                }
                
            </ul>
        </div>        
    </Template>
    <DrawerContent>
        @SelectedItem?.Description
    </DrawerContent>
</TelerikDrawer>
@code {
    public TelerikDrawer<DrawerItem> Drawer { get; set; }
    public DrawerItem SelectedItem { get; set; }
    public bool Expanded { get; set; } = true;
    public IEnumerable<DrawerItem> Data { get; set; } =
    new List<DrawerItem>
    {
            new DrawerItem
            {
                Title = "Well hello there!",
                Text = "Getting Started",
                Icon = SvgIcon.QuestionCircle,
                Description = "The Blazor framework by Microsoft allows you to create web applications with .NET and C# to create front-end. The Telerik® UI for Blazor components facilitate the front-end development by providing you with ready made UI components."
            },
            new DrawerItem
            {
                Text = "Components",
                Icon = SvgIcon.Categorize,
                Description = "Blazor is still a new technology and the component suite is young. We are constantly working on adding new features and components. Tell us which components you want implemented and how you intend to use them, and Blazor, at our feedback portal.",
                Children = new List<DrawerItem>()
                {
                    new DrawerItem
                    {
                        Text = "Grid",
                        Icon = SvgIcon.Grid,
                        Level = 1,
                        Description = "The Telerik Blazor Data Grid provides a comprehensive set of ready-to-use features covering everything from paging, sorting, filtering, editing, and grouping to row virtualization, optimized data reading, keyboard navigation and accessibility support." },
                    new DrawerItem
                    {
                        Text = "Calendar",
                        Icon = SvgIcon.CalendarDate,
                        Level = 1,
                        Description = "The Calendar component allows the user to scroll through a calendar and select one or more dates. "
                    },
                    new DrawerItem
                    {
                        Text = "Menu",
                        Icon = SvgIcon.Menu,
                        Level = 1,
                        Description = "The Menu component displays data (flat or hierarchical) in a traditional menu-like structure."
                    },
                }
            },
            new DrawerItem
            {
                Text = "Browser Support",
                Icon = SvgIcon.Calendar,
                Description = "Browsers supported by Telerik UI for Blazor: Chrome (including Android and iOS), Edge, Firefox, Safari (including iOS)"
            }
        };
    public async Task ToggleDrawer() => await Drawer.ToggleAsync();
    protected override void OnInitialized()
    {
        SelectedItem = Data.First();
    }
    public void OnItemSelect(DrawerItem selectedItem)
    {
        SelectedItem = selectedItem;
        selectedItem.Expanded = !selectedItem.Expanded;
        var newData = new List<DrawerItem>();
        foreach (var item in Data.Where(x => x.Level <= selectedItem.Level))
        {
            newData.Add(item);
            if (item == selectedItem && selectedItem.Expanded && (item.Children?.Any() ?? false))
            {
                foreach (var child in item.Children)
                {
                    newData.Add(child);
                }
            }
            if (item != selectedItem && !(item.Children?.Contains(selectedItem) ?? false))
            {
                item.Expanded = false;
            }
        }
        Data = newData;
    }
    public class DrawerItem
    {
         public string Title { get; set; }
        public string Text { get; set; }
        public ISvgIcon Icon { get; set; }
        public bool Expanded { get; set; }
        public int Level { get; set; }
        public string Description { get; set; }
        public IEnumerable<DrawerItem> Children { get; set; }
    }

}

 

Hristian Stefanov
Telerik team
 answered on 19 Apr 2024
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?