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

Source binding to the Menu Widget or other widgets

9 Answers 257 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
M
Top achievements
Rank 1
M asked on 17 Apr 2012, 07:46 PM

The Demo here:

http://demos.kendoui.com/web/mvvm/widgets.html

Shows how to bind to a number of widgets in the Kendo UI library.  But I haven't had luck with some others including the menu.  I've tried to convert the example here:

http://demos.kendoui.com/web/menu/index.html

To use the MVVM framework in the most straighforward manner.  To be sure the KendoUI library was properly referenced, I put the MVVM test together with the non-MVVM method show in the demo.  The result is that only the non-MVVM method works.  The MVVM menu does not render (it shows up empty - just a thin horizontal line).  There are no runtime errors or exceptions thrown.

HTML:

<body> 
    <ul id="menu">
    </ul>
    <br />
    <ul data-role="menu" data-bind="source: dataSource">
   
</ul>
</body>

JavaSript:
$(document).ready(documentReady);

var viewModel = {
    dataSource: [
        {
            text: "Menu Item 1",
            items: [
                { text: "Sub Menu Item 1" },
                { text: "Sub Menu Item 2" }
            ]
        },
        { text: "Menu Item 2" }
    ]};

function documentReady() {
    $("#menu").kendoMenu(viewModel);
    kendo.bind($("body"), kendo.observable(viewModel));
}

9 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 Apr 2012, 04:16 PM
The hierarchical Kendo UI widgets (Menu, PanelBar, TreeView) do not support true DataSource binding, thus this is not currently possible. We are researching options to enable this in a future release, but for now, you might need to remove the menu from the page and initialize it again when the ViewModel changes.

All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joshua
Top achievements
Rank 1
Veteran
Iron
answered on 24 Jun 2013, 02:25 PM
Has this ever been fixed?
0
Alex Gyoshev
Telerik team
answered on 26 Jun 2013, 12:05 PM
Hello Joshua,

At this time, only the TreeView widget supports hierarchical binding, as shown in the binding to remote data example. This feature is not yet planned to be added for the Menu or PanelBar widgets.

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joshua
Top achievements
Rank 1
Veteran
Iron
answered on 26 Jun 2013, 12:29 PM
This really makes it hard to standardize on MVVM. Now my code is 90% MVVM, then I have all of this extra junky stuff, when I need to manipulate a menu. Basically what I end up doing is maintaining several menus for different permission sets and then showing and hiding them as needed, but they still live on the form :(
0
Thomas
Top achievements
Rank 1
answered on 28 Feb 2014, 11:26 AM
I agree 100% with Joshua. You cannot have only a discretionary part of your widgets working with MVVM. And I mean you should respect your own standard implementation. The same goes with the widget options: why only some options can be used in the data binding attributes?.
0
Basem
Top achievements
Rank 1
answered on 15 Mar 2014, 09:31 PM
This thread is almost 2 years old and still no plans yet for MVVM sources for menus and panelbars? I would start a uservoice suggestion but this really should be part of the Kendo MVVM.
0
Olivier
Top achievements
Rank 1
answered on 08 May 2014, 04:35 PM
Hi guys,

Any plans to add source binding to the menu widget?

Thanks.
0
Markus
Top achievements
Rank 1
answered on 05 Jun 2014, 09:14 PM
I would also like to see this. As others have mentioned, only going 90% MVVM isn't ideal.
0
Alex Gyoshev
Telerik team
answered on 06 Jun 2014, 07:26 AM
Hello all,

In order to raise the priority of these items, vote on UserVoice (DataSource for Menu, DataSource for PanelBar). Once they gather enough votes, they will become planned and implemented in the next release.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MVVM
Asked by
M
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Joshua
Top achievements
Rank 1
Veteran
Iron
Thomas
Top achievements
Rank 1
Basem
Top achievements
Rank 1
Olivier
Top achievements
Rank 1
Markus
Top achievements
Rank 1
Share this question
or