Partial templated node highlight and selection

5 posts, 1 answers
  1. JustinWong
    JustinWong avatar
    147 posts
    Member since:
    Mar 2007

    Posted 08 Oct 2009 Link to this post

    Hi:

    My treeview has templated nodes with 2 labels in it: one below the other (id=Label01 and Label02).  Currently, when the mouse hoovers over the node, both lines / labels are highlighted. Is there a way to for me to refine that, so:

    If the mouse hoovers over the first label / line, then only that line is highlighted? 

    Also, if the user clicks on the node, how can I capture whether the user clicked on Label01 or Label02?

    Many thanks in advance for you help!

    Justin
  2. Answer
    Yana
    Admin
    Yana avatar
    5013 posts

    Posted 12 Oct 2009 Link to this post

    Hello Justin,

    Please find attached your modified page demonstrating the needed approach.

    Best wishes,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. JustinWong
    JustinWong avatar
    147 posts
    Member since:
    Mar 2007

    Posted 12 Oct 2009 Link to this post

    But how can I make the node jump off the page and kiss me?

     

    Just kidding. You folks are SO GOOD, it's unbelieveable!

     

    Justin

  4. JustinWong
    JustinWong avatar
    147 posts
    Member since:
    Mar 2007

    Posted 08 Nov 2009 Link to this post

    Hi Yana:

    Okay. I need help on another issue with this scenario:

    So, the template node has 2 labels, just like before.  Now, I have a RadTreeViewContextMenu built into the TreeView.

    Is there away to show the context menu ONLY when the user right-click on Label01 and NOT when the user right-click on Label02?  I am guesssing that this is done within the ClientContextMenuShowing function? Somehow, within this function, I test with Label the user right-click on and if it is Label02, then I cancel out of the function? 

    But I don't know how to test which Label the user right-clicked within this function. Can you please help me?

    Thanks again!

    Justin
  5. Yana
    Admin
    Yana avatar
    5013 posts

    Posted 12 Nov 2009 Link to this post

    Hi Justin,

    ClientContextMenuShowing event will definitily do the work in this case, you can find which label is right-clicked in the same way as in OnClientNodeClicked event:

    function contextMenuShowing(sender, args) {
        if (!(args.get_domEvent().target.id.indexOf("ItemLabel") > -1))
            args.set_cancel(true);
    }

    I've attached the modified page for a reference.

    Kind regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top