Selectednode scrollIntoView do not scroll to the selected node

8 posts, 0 answers
  1. Anamika
    Anamika avatar
    124 posts
    Member since:
    Mar 2014

    Posted 08 Sep 2014 Link to this post

    Hello,

    I have a treeview in a splitter and on serach i select the node by id and then shouold scroll the treeview so that the selected node is visible. the selection works but treeview will not scroll atall. i have tried Setting focues as well but it will not move at all.

    here is the jquery part for selection amnd then scrolling
    ​ node = treeview.findByUid(ds.get(path[0]).uid);
    treeview.select(node);

    treeview.trigger("select", { node: node });
    node.scrollIntoView(true);
    node.Focus();

    Thanks

    anamika
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 10 Sep 2014 Link to this post

    Hello Anamika,

    See this Dojo snippet for a demo how to use the jQuery scrollTo plug-in, that will provide a smooth interaction.

    Regards,
    Alex Gyoshev
    Telerik
     
    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. Anamika
    Anamika avatar
    124 posts
    Member since:
    Mar 2014

    Posted 21 Oct 2014 in reply to Alex Gyoshev Link to this post

    Sorry for re-opening this, but my treeview is inside nested Kendo splitter and data is dynamic and depending on id of node i load all parents and expand and then select the node . So this plug in somehow is not Scrolling the node to view. I could scroll using this alternative way in select Event of treeview
    var eleTop = $(e.node).offset().top;
    var treeScrollTop = $("#treeview").scrollTop();
    var treeTop = $("#treeview").offset().top;
    $("#treeview").animate({
    scrollTop: (treeScrollTop + eleTop) - treeTop
    });

    But this is extremely slow and when i manually select a node this is Scrolling it to top as well which i do not Need.
    Is there another way to scroll the node to view?
  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 22 Oct 2014 Link to this post

    Hello Anamika,

    From your message, I could not understand whether the scrolling is slow or not working. Can you provide a snippet that illustrates the problem?

    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. Anamika
    Anamika avatar
    124 posts
    Member since:
    Mar 2014

    Posted 22 Oct 2014 in reply to Alex Gyoshev Link to this post

    hello,

    As you can see i am scrolling the selected node to viewport in OnSelect event of treeview. So there is a lag everytime i select manually a node it will first scroll to top and then the related data is shown in a side grid. I have a search box and when user inputs and click search then only i should be searching the child node and all parent nodes and expandpath and then scroll that node of treeview into view. So as soon as expandpath is expanding if i can scroll to node there it should help. I should not be scrolling in treeview select method as when i manually select a node i should not scroll to view.
    Have tried scrollto method as soon as expandpath is called but it will not scroll node to view.

    Hope i am clear now.

    Thanks

    Anamika

  7. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 24 Oct 2014 Link to this post

    Hello Anamika,

    Why trigger the scroll in the select event? The select event is triggered when the user clicks the node, not when the API method is called. If the user can click the node, then scrolling to the selected node is not needed. From the app description, it appears that you need to trigger the scrolling when the textbox changes the treeview selection. If that is not the problem, submit a sample to eliminate all guesswork.

    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. Krishna
    Krishna avatar
    6 posts
    Member since:
    Apr 2015

    Posted 12 May Link to this post

    I Dojo Snippet you provided above it is does not work if you explicitly set height of "treeview-left" otherwise it works. In my scenario i cannot get by without setting the height. Can you please help?
  9. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 13 May Link to this post

    Hello Krishna,

    Moving the scrollbar to another element requires you to call the scrollTo method on it, when you need it to scroll.

    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