Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
480
DropDown with Tree inside, set focus to the tree
posted

Hi,

I'm not sure if I should put this here or in the WebDataTree section.

Anyway, I have this web user control that implements a WebDropDown with a WebDataTree inside.

I need it to behave as close as possible to a normal dropdown, so if I set the focus to the  dropdown and press the arrow keys in the keyboard I should be able to navigate through the items of the tree. The navigation inside the tree works ok (kind of, I have another question open regarding the scroll of the dropdown), but I need to set the focus to the tree when pressing the arrows in the dropdown.

I have attached a small demo project.

Thanks in advance.

TreeDemo.rar
Parents
No Data
Reply
  • 480
    Verified Answer
    posted

    Hi, I finally managed to do with this in the inputKeyUp client event of the DropDown

    function setFocus(sender, args) {
      var key = args._props[0].keyCode;
      if(key >= 37 && key <= 40)
      {
        sender.openDropDown();
        setTimeout(function() {
        $('#' + sender._id + ' input._tree_f_e_').first().focus();
        }, 200);
      }
    }

    Thanks anyway.

    TreeDemo.rar
Children