Source binding to the Menu Widget or other widgets

Thread is closed for posting
10 posts, 0 answers
  1. M
    M avatar
    1 posts
    Member since:
    Apr 2012

    Posted 17 Apr 2012 Link to this post

    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));
    }
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 19 Apr 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Joshua
    Joshua avatar
    66 posts
    Member since:
    May 2012

    Posted 24 Jun 2013 Link to this post

    Has this ever been fixed?
  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 26 Jun 2013 Link to this post

    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!
  6. Joshua
    Joshua avatar
    66 posts
    Member since:
    May 2012

    Posted 26 Jun 2013 Link to this post

    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 :(
  7. Thomas
    Thomas avatar
    9 posts
    Member since:
    Oct 2012

    Posted 28 Feb 2014 Link to this post

    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?.
  8. Basem
    Basem avatar
    27 posts
    Member since:
    Dec 2010

    Posted 15 Mar 2014 Link to this post

    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.
  9. olivier
    olivier avatar
    14 posts
    Member since:
    Feb 2011

    Posted 08 May 2014 Link to this post

    Hi guys,

    Any plans to add source binding to the menu widget?

    Thanks.
  10. Markus
    Markus avatar
    1 posts
    Member since:
    Jul 2012

    Posted 05 Jun 2014 Link to this post

    I would also like to see this. As others have mentioned, only going 90% MVVM isn't ideal.
  11. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 06 Jun 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready