Panelbar loadondemand to false with items that loadcontentfrom

1 Answer 9 Views
PanelBar
Youssef
Top achievements
Rank 1
Youssef asked on 26 Apr 2022, 02:21 PM

Hi,

So basically I'm trying to load the items of my PanelBar at the creation of the PanelBar. My item has a LoadContentFrom itself but it only triggers once I open the panelbar item. It used to work with the LoadOnDemand property set to false but it doesn't anymore. Any idea what is I am doing wrong here?

@(Html.Kendo().PanelBar()
            .Name("panelbar")
            .ExpandMode(PanelBarExpandMode.Multiple)
            .HtmlAttributes(new { @class = "k-primary", type = "submit", style = "width:100%" })
            .LoadOnDemand(false)
            .Items(panelbar =>
            {
                panelbar.Add().Text("Item Title").LoadContentFrom(Url.Action("Function", "Controller", Model));
            }))

 

Thanks again!

1 Answer, 1 is accepted

Sort by
0
Yanislav
Telerik team
answered on 29 Apr 2022, 08:03 AM

Hello Youssef,

The LoadContentFrom affects the data source of the component. It indicates whether the child DataSources should be fetched lazily when parent groups get expanded. Setting this to false causes all child DataSources to be loaded at initialization time. 

About the requirement, if I understand correctly, the desired behavior is to load all the content of the PanelBar when the page is loaded. If so, you could try the following approach : 

    $(document).ready(function () {
        var panelBar = $("#panelbar").data("kendoPanelBar");
        panelBar.reload("> .k-item");
    })

The reload method reloads the content of a PanelBar from an AJAX request.

I hope this helps!

Regards,
Yanislav
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
PanelBar
Asked by
Youssef
Top achievements
Rank 1
Answers by
Yanislav
Telerik team
Share this question
or