Not able to get datasource for collapsed tree node

8 posts, 0 answers
  1. deepak
    deepak avatar
    5 posts
    Member since:
    Mar 2013

    Posted 18 Nov 2013 Link to this post

    Hi all,
      I am having treeview with checkboxes on kendo window, treeview datasource bound using ajax call and having some of it's nodes in checked state while loading the treeview, if tree is in collapsed state then while i am doing empTreeview.dataSource.view() then i am not able to get the collapsed node in collection.
    I want the checked checkboxes in collapsed node as well.
    Please reply.
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 18 Nov 2013 Link to this post

    Hello,


    The child nodes of the TreeView by default are fetched lazily i.e. they will be fetched only when the parent gets expanded. This behavior could be configured through the loadOnDemand option. If it is set to false all nodes will be fetched during initialization.

    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. deepak
    deepak avatar
    5 posts
    Member since:
    Mar 2013

    Posted 19 Nov 2013 Link to this post

    Thanks for the reply loadOnDemand:false reoslved my issue. But started facing another  issue as while loading treeview browser goes into not responding state and sometime it is geeting crashed. How do i optimize loading time with one time load treeview datasource.(As i need all checked items in collapsed state as well so thats why i cant apply loadondemand:true in my case).
    Please reply.
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 20 Nov 2013 Link to this post

    Hi,

    Another option in the current case is to use local data so it will be bound at once. This is demonstrated in the following demo.

    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Kyle
    Kyle avatar
    22 posts
    Member since:
    Aug 2011

    Posted 04 Dec 2013 Link to this post

    I agree completely with deepak here.  I understand that to obtain data in children, we need to turn off loadOnDemand.  However, doing so, even with inline data, causes the browser to become unresponsive.

    I created a simple JSBin to show what I'm doing in an attempt to reproduce the issue.  It seems to work very nicely in Chrome (currently version 31).  It does not work as nicely in FireFox 25.0.1 or IE10.  The JSBin DOES work a hair faster than the development I'm doing, but if you watch closely, you'll still see FF or IE temporarily "Not Respond."

    Please tell me there's a way around this?  I need to be able to read the entire data source upon initial load.  Or is there an expanding/expanded (yes, both) event?  (I would like to show a progress icon when the user expands a node and turn it off when it's loaded.  I'd also like to see the children items immediately after expand.)
  6. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 06 Dec 2013 Link to this post

    Hello Kyle,

    Since the TreeView is bound to the datasource, reading all items into the datasource renders the complete tree. This is in turn slow, because the TreeView renders its items incrementally, rather than in one operation. We will revise if the latter can be improved upon, and I'll follow up in this thread next week.

    Regards,
    Alex Gyoshev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 11 Dec 2013 Link to this post

    Hello Kyle,

    I have inspected the scenario that you posted in jsBin. You can make it significantly faster by not rendering empty items arrays -- about 3x improvement, depending on the count of empty nodes. My initial assumption did not stand correct, as large hierarchies can be created very fast, but having empty items arrays causes a lot of empty datasources to be created, which is a memory and computation intensive operation. Here is a modified jsBin that shows almost instant load.

    Regards,
    Alex Gyoshev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  8. Kyle
    Kyle avatar
    22 posts
    Member since:
    Aug 2011

    Posted 11 Dec 2013 Link to this post

    Alex,

    Thank you!  This is wonderful information to have.  I have included it in my documentation so that our other developers don't fall into the same trap as me.

    As always, I appreciate your hard work,
    Kyle
Back to Top