Binding Expanded of treeview (mvc)

2 posts, 0 answers
  1. Justin Lee
    Justin Lee avatar
    146 posts
    Member since:
    Dec 2009

    Posted 27 Apr Link to this post

    It appears setting the Expanded property in the ItemDataBound event doesn't work. Is that correct?  What options do I have?

    For example:  Setting item.Expanded doesn't appear to do anything.  (I verified IsExpanded is true in my models)

      .BindTo(Model.Items, mappings =>
         mappings.For<MyModelClass>(binding =>
           binding.ItemDataBound((item, child) =>
             item.Text = child.Name;
             item.Selected = child.IsSelected;
             item.Expanded = child.IsExpanded;
           .Children(x => x.ChildItems)

  2. Alex Gyoshev
    Alex Gyoshev avatar
    2497 posts

    Posted 29 Apr Link to this post

    Hello Justin,

    The ExpandAll(false) call registers a post-processing action that is executed after the call to BindTo. Thus, after binding, all Expanded flags are set to false. To resolve this, remove the call to ExpandAll.

    Alex Gyoshev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top