Telerik Forums
UI for Blazor Forum
1 answer
773 views

Hello,

In the Telerik multiselect, when I select some options in my multiselect, the multiselect div expands and the display doesn't look good. So I now just want to show the number of options selected instead of the options selected. I looked for it but could not find some solutions regarding it.

For ex, lets say there are the following options in the multiselect: One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten.

Now when I select One, Five and Seven from the multiselect dropdown, I want the text inside the multiselect component to be "3 selected".

Is there any workaround for it?

 

Thanks,

Susan

Marin Bratanov
Telerik team
 answered on 30 Jan 2022
1 answer
145 views

I have a grid setup, and would like to double click to open the pop up to edit the row.  I set the Grid and add the OnRowDoubleClickHandler to my code.  I tested that this works, from the debugger when I double click a row the Handler gets called correctly.

I then add code to get the current state from the grid, I setup the EditItem and the OriginalEditItem then I Set the State.

My problem is I need todo Three clicks to get this to work.  I have to double click the row, then wait and click once more in the same row, then the pop up editor comes up.  I can do fast three clicks and it works as well.  If I double click on the row to edit, then even click once time on any other row, the original row comes up for edit.

From the examples I am setting the state like this:

 var currState = GridRef.GetState();
        // reset any current insertion and any old edited items. Not mandatory.
        currState.InsertedItem = null;

        // add item you want to edit to the state, then set it to the grid
        SampleData originalItem = MyData.Where(itm => itm.ID == 4).FirstOrDefault();
        SampleData itemToEdit = SampleData.GetClonedInstance(originalItem);

        // you can alter values here as well (not mandatory)
        //itemToEdit.Name = "Changed from code";
        currState.EditItem = itemToEdit;
        currState.OriginalEditItem = originalItem;

        // for InCell editing, you can use the EditField property instead
        await GridRef.SetState(currState);
Russ
Top achievements
Rank 1
Iron
 answered on 28 Jan 2022
1 answer
276 views

What happened to it? Don't know if it affected the code below. In either case the code is not working. Seems like it should

 

I am trying to write code to expand/collapse nodes when they are clicked on regardless if I click on  the expand arrow or text.

Getting nowhere.


    private void OnTvItemClick(object e, TreeItem tvItem)
    {
        if(tvItem.HasChildren)
        {
            tvItem.Expanded = !tvItem.Expanded;
        }
    }

Can  you help?

Thanks ... Ed

 

Apostolos
Telerik team
 answered on 28 Jan 2022
2 answers
350 views

I am wanting to display a static line on a line chart to show a target the is hoping to be reached.

the screenshot is an example of the current graph and what we need is a solid line to be shown at a set value for example 2250 that goes all the way across so that you can see which points are hitting the target needed.

Peter
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 28 Jan 2022
1 answer
232 views

Hello, right now, I am getting the "Object reference not set to an instance of an object." error for rendering the Gantt Timeline. I'm not sure how to send the data from the Gantt Tree to the timeline or setting the timeline to the correct model. The tree renders just fine. Help with understanding Data Binding with the parameters (IdField, ParentIdField, ItemsField, HasChildrenField) will be great as well.


Razor Page:


<TelerikGantt Data="@SchedulesList"
                  @bind-View="@SelectedView"
                  IdField="Id"
                  ParentIdField=""
                  Width="100%"
                  Height="600px"
                  Sortable="true"
                  SortMode="@SortMode.Multiple"
                  FilterMode="@GanttFilterMode.FilterMenu"
                  FilterMenuType="@FilterMenuType.Menu">
               
        <GanttViews>
            <GanttDayView></GanttDayView>
            <GanttWeekView></GanttWeekView>
            <GanttMonthView></GanttMonthView>
            <GanttYearView></GanttYearView>
        </GanttViews>
        <GanttColumns>
            <GanttColumn Field="Sequence"
                         
                         Title="Sequence">
            </GanttColumn>
            <GanttColumn Field="ScheduledStart"
                        
                         Title="Scheduled Start"
                         >
            </GanttColumn>
            <GanttColumn Field="ScheduledEnd"
                        
                         Title="Scheduled End">
            </GanttColumn>
            <GanttColumn Field="ScheduledDuration"
                         
                         Title="Scheduled Duration">
            </GanttColumn>
            <GanttColumn Field="Activity.Name"
                        
                        Title="Activity Name">
            </GanttColumn>
            <GanttColumn Field="Resource.Name"
                         
                         Title="Resource Name">
            </GanttColumn>
        </GanttColumns>
    </TelerikGantt>



@code {
    private List<VentureBlazor.Models.ActivityResource> SchedulesList { get; set; }
    private List<VentureBlazor.Models.Activity> ActivitiesList { get; set; }
    private List<VentureBlazor.Models.Resource> ResourcesList { get; set; }
    private ActivityScheduleRepository repo;
    public GanttView SelectedView { get; set; } = GanttView.Year;

    protected override async Task OnInitializedAsync()
    {
        repo = new ActivityScheduleRepository(ContextFactory.CreateDbContext());
        await LoadSchedules();
         
        base.OnInitialized();
       
    }

     public async Task LoadSchedules()
    {
        ActivitiesList = await repo.GetAllActivitiesAsync();
        ResourcesList = await repo.GetAllResourcesAsync();
        SchedulesList = await repo.GetAllActivityResourceSchedulesAsync();

    }

      public void Dispose()
        {
            repo.Dispose();
        }
}
Model:

 public class ActivityResource
    {
        [Key]
        public int Id { get; set; }
        public int ActivityId { get; set; }

        public int ResourceId { get; set; }

        public double Sequence { get; set; }

        public DateTime ScheduledStart { get; set; }

        public DateTime ScheduledEnd { get; set; }

        public double ScheduledDuration { get; set; }

        public Activity Activity { get; set; }

        public Resource Resource { get; set; }
    }

    public class Resource
    {
        public int Id { get; set; }
        public string Name { get; set; } = "New Resource";
        public string Description { get; set; }

        public int ResourceTypeId { get; set; }
        public virtual ResourceType ResourceType { get; set; }



        public ICollection<Activity> Activities { get; set; }
        public ICollection<Project> Projects { get; set; }


        public List<ActivityResource> ActivityResources { get; set; }
        public List<ProjectActivity> ProjectActivities { get; set; }


    }


Nadezhda Tacheva
Telerik team
 answered on 28 Jan 2022
1 answer
739 views

Hello,

I'm trying to use font-awesome in the Blazor Drawer. I can use the font anywhere except with the Drawer.

For my test, you can look at the first MenuItem for Trucks.

Thanking you in advance.

Daniel Legare

 

@inherits LayoutComponentBase


<TelerikRootComponent>
<TelerikDrawer @ref="SidebarLeft" Data="menuItems" MiniMode="true" Mode="@DrawerMode.Push" @bind-SelectedItem="SelectedItem">
<DrawerContent>
<div class="main">
<div class="top-row px-4">
<TelerikButton OnClick="@ToggleDrawer" Icon="menu" FillMode="@(ThemeConstants.Button.FillMode.Flat)"></TelerikButton>
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a>
</div>

<div class="content px-4">
@Body
</div>
</div>
</DrawerContent>
</TelerikDrawer>
</TelerikRootComponent>

@code {
public TelerikDrawer<MenuItem> SidebarLeft { get; set; }
        public MenuItem SelectedItem { get; set; }

public async Task ToggleDrawer() => await SidebarLeft.ToggleAsync();

private IEnumerable<MenuItem> menuItems => new List<MenuItem>
{
new MenuItem {Text = "Trucks", Url = "/truck", Icon = "<i class='fa-solid fa-truck' />"},
new MenuItem {Text = "Clients", Url = "client", Icon = "myspace"},
new MenuItem {Text = "Earth", Url = "/earth", Icon = "globe"},
new MenuItem {Text = "Contacts", Url = "/contact", Icon = "user"},
};
}
Chuck
Top achievements
Rank 1
Iron
 updated answer on 28 Jan 2022
1 answer
126 views

Dear Telerik Team!

Is there a way to make the treeview scroll so that a speficic node is visible? I need to make the node visible that was selected by code.
So I am looking for a way to do what the .BringIntoView() method in the WPF treeview does...

thanks and regards

Sven

Dimo
Telerik team
 updated answer on 27 Jan 2022
2 answers
158 views

Is anyone using the code from the free book and getting it to build/run?

I can't get past the event call back code on pages 46-47. I find the code references OnSelected="HandleItemSelected" delegate when no procedure/var exists with that name. I think I need to add a delegate to WeatherDay component.

Book:

<WeatherDay TemperatureC="forecast.TemperatureC"
Summary="@forecast.Summary"
DayOfWeek="forecast.Date.DayOfWeek"
OnSelected="HandleItemSelected"
Selected="forecast.Selected">

I tried:

<WeatherDay TemperatureC="forecast.TemperatureC"
Summary="@forecast.Summary"
DayOfWeek="forecast.Date.DayOfWeek"
OnSelected="HandleOnSelected"
Selected="forecast.Selected">

Ed
Top achievements
Rank 1
Iron
 answered on 26 Jan 2022
1 answer
329 views
I want to prevent the user browsing back to previous days
Nadezhda Tacheva
Telerik team
 answered on 26 Jan 2022
1 answer
392 views

 

1. Is it possible to export an hierarichal grid to excel (with all its nested levels nd their values ).

Marin Bratanov
Telerik team
 answered on 26 Jan 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?