This is a migrated thread and some comments may be shown as answers.

Panel bar data object is null in initialization

2 Answers 75 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Achilles
Top achievements
Rank 1
Achilles asked on 09 Jul 2013, 11:52 AM
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 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 11 Jul 2013, 11:57 AM
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!
0
Achilles
Top achievements
Rank 1
answered on 17 Jul 2013, 09:49 AM
Hi Vladimir,
Thanks. It solved the problem

Regards

Raja
Tags
PanelBar
Asked by
Achilles
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Achilles
Top achievements
Rank 1
Share this question
or