Gantt for ASP.NET MVC Initialized in Container Does Not Render Properly
Environment
Product | Progress® Telerik® UI Gantt for ASP.NET MVC |
Description
My Gantt chart is placed in PanelBar item content that is not initially visible. When activating this item, the Gantt does not render properly.
Cause
The Gantt was initialized in a hidden (display: none;
) container.
Solutions
-
Use the deferred initialization of the Gantt.
@(Html.Kendo().Gantt<InPanelBar.Models.TaskViewModel, InPanelBar.Models.DependencyViewModel>() .Name("Gantt") ... .Deferred() )
-
Initialize the widget on the first
activate
event of the PanelBarItem that contains it.function onActivate(e) { var item = e.item; var title = $(item).find('a.k-header').text(); var gantt = $('#Gantt').getKendoGantt(); if (title === "Add Contenuti" && !gantt) { @Html.Kendo().DeferredScriptsFor("Gantt", false); } }