Multiple databound

4 posts, 0 answers
  1. Philippe
    Philippe avatar
    2 posts
    Member since:
    Mar 2011

    Posted 01 Apr 2015 Link to this post

    Hello,

    Here is the situation. I have a treeview that basically represents directory, sub-directory and files. For some reasons, I can't use the LoadOnDemand option. So I load all the tree in my controller.
    Everything works fine except that it seems the Databound event is triggered for each directory and subdirectory. I was expecting the event to be triggered only once when all data are "loaded" from the datasource.
    At the end, I need to expand some nodes everytime the datasource is refreshed

    This is my treeview

        @(Html.Kendo().TreeView()
            .Name("treeview")
            .DataTextField("name")
            .LoadOnDemand(false)
            .DataSource(datasource => datasource.Read(read => read.Action("Tree_Read_All", "MyController"))
            .Model(model => model.Children("childrens")))
            .DragAndDrop(true)
            .Events(events => events
                .Select("treeViewOnSelect")
                .Drop("treeViewOnDrop")
                .DataBound("treeViewDataBound")
            )
        )

    Thanks in advance
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 03 Apr 2015 Link to this post

    Hello Philippe,

    This behavior is expected, the dataBound event is fired for every level that is loaded in the TreeView, and there is no workaround for this at the moment. You can submit this as a feature request on UserVoice, so that it is considered for implementation in a future release.

    Regards,
    Kiril Nikolov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Philippe
    Philippe avatar
    2 posts
    Member since:
    Mar 2011

    Posted 03 Apr 2015 in reply to Kiril Nikolov Link to this post

    Hello Kiril,

    Thank you for your reply.

    Basically, I juste want to expand the nodes that were expanded before the refresh. So I currently store all the expanded node Id before the refresh. When the operation is complete, I want to parse my tree and re-expand the nodes.

    So is there a way to know when the refresh operation is complete (all the nodes are loaded).
    Or maybe there is an easier way to achieve what I want to do ?

  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 07 Apr 2015 Link to this post

    Hello Philippe,

     

    I am afraid that with the currently available methods and events, there is no way to know when the last item is loaded, you can see how many first level childs do you have so they will be loaded with the corresponding dataBound's and after the last one is loaded you can start the expanding from the saved selection.

     

    Regards,
    Kiril Nikolov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready