Panel bar data object is null in initialization

3 posts, 1 answers
  1. Answer
    Achilles
    Achilles avatar
    57 posts
    Member since:
    Jan 2013

    Posted 09 Jul 2013 Link to this post

    Hello,

    I'm trying to migrate a panel bar from MVC extensions to Kendo. When the Panel bar loads, I expand specific items via a initialization script.
    What I find is that if I call

    var panelbar = $("#PanelBar").data("kendoPanelBar");

    in $(document).ready() as adviced as in

    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/migration/widgets/panelbar, I get a null object.
    This call however succeeds to get the correct object if called later.
    Since, onLoad() is removed in Kendo, is there any other way I can initialize my Panelbar ?

    Kind Regards

    Achilles
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 11 Jul 2013 Link to this post

    Hi Raja,


    Basically when you need to access the PanelBar in this way you should place that script after the PanelBar initialization script as it also uses document ready event:

    e.g.:

    @(Html.Kendo().Grid<ForeignKeyColumnDemo.Models.Order>()
        .Name("Grid")   
        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable()
        .DataSource(dataSource => dataSource       
            .Ajax()     
            .ServerOperation(false)
            .Read(read => read.Action("Read", "Home"))
        )
    )
     
    <script>   
        //below script must be executed after the widget is fully loaded
        //tis can be achieved by placing it after the width
        $(function () {
            var grid = $("#Grid").data("kendoGrid");
            debugger;
        })
    </script>
    Kind Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Achilles
    Achilles avatar
    57 posts
    Member since:
    Jan 2013

    Posted 17 Jul 2013 Link to this post

    Hi Vladimir,
    Thanks. It solved the problem

    Regards

    Raja
Back to Top