MVVM auto focus

2 posts, 1 answers
  1. Matjaz
    Matjaz avatar
    94 posts
    Member since:
    Jun 2014

    Posted 01 Dec 2014 Link to this post

    How can I activate (focus) window which is not opened with open method, but with MVVM. I need window is focused when page loaded. In your example autoFocus with MVVM is not working.
  2. Answer
    Alexander Valchev
    Alexander Valchev avatar
    2895 posts

    Posted 03 Dec 2014 Link to this post

    Hi Matjaz,

    You may use the jQuery focus method. Please check the following example:
    Note that the window's visibility is bound to the toggleVisibility method of the ViewModel.

    toggleVisibility: function() {
      setTimeout(function() {
        return this.get("isVisible");

    I hope this approach will fit in your scenario.

    Alexander Valchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top