Node Select Cancel - Focus

3 posts, 1 answers
  1. Dave
    Dave avatar
    2 posts
    Member since:
    Oct 2015

    Posted 30 Oct 2015 Link to this post

    In my TreeView, while I have a node selected and I click another node in the tree, if I cancel the select via "e.preventDefault()" in my Select event handler, the selection is cancelled but the node I clicked retains focus.  Is there a way of preventing this (removing focus from the node I clicked)?  I tried adding code to remove the "k-state-focused" class from the node, but it does not work...

    $("#treeview_tv_active span.k-state-focused").removeClass("k-state-focused");

  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 03 Nov 2015 Link to this post

    Hello Dave,

    Thank you for contacting Telerik Support.

    In order to remove the focused styles from the clicked item you should wrap the code for removing the k-state-focused class within a setTimeout function:
        select: function (e) {
            setTimeout(function () {

    Could you please give the above approach a try and let me know if the result meets your exact requirements.

    I am looking forward to your reply.

    Konstantin Dikov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Dave
    Dave avatar
    2 posts
    Member since:
    Oct 2015

    Posted 03 Nov 2015 in reply to Konstantin Dikov Link to this post

    Yes, that seemed to work.  Thank you!
Back to Top