Expand to specific item

2 posts, 0 answers
  1. Roger
    Roger avatar
    1 posts
    Member since:
    Jan 2015

    Posted 13 Jan 2015 Link to this post

    How can I expand to a specific item?
    I use a treelist with remote datasource. I start non-expanded but after first load I'd like to expand all rows until a specific item and sedlect this item.

    Thank you!
  2. Alex Gyoshev
    Alex Gyoshev avatar
    2497 posts

    Posted 15 Jan 2015 Link to this post

    Hello Roger,

    There is no out of the box method to achieve this. In order to expand all levels up to a given node, you need to know the IDs of all of its parents (the so-called path).

    If you know the path on the server-side, it is most efficient to set the expanded flag of all nodes along the path when you serialize them from the server, and serialize their sibling nodes as well.

    If you expand the items on the client-side, you will need to make one request for each parent along the path. You can achieve this by calling the expand method in the dataBound event, making one step on the path each time.

    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