On itemClick method, e.sender._selectedItemIndex returns previous value

3 posts, 0 answers
  1. Deniz
    Deniz avatar
    6 posts
    Member since:
    Jul 2020

    Posted 28 Jul 2020 Link to this post

    I want to reach selected item's index in the drawer widget. When I examine e.sender from console like this,


    I can find updated value of e.sender._selectedItemIndex.

    However, when I want to use e.sender._selectedItemIndex variable directly I get previous value of e.sender._selectedItemIndex. For example, If I open drawer for the first time and select an first item, from console I can see that e.sender's _selectedItemIndex variable is equal to 0 but console.log(e.sender._selectedItemIndex) prints undefined. When I select any other item from drawer, now console.log(e.sender._selectedItemIndex) prints 0. How can I reach and use e.sender._selectedItemIndex's updated value in itemClick function?


  2. Tsvetomir
    Tsvetomir avatar
    796 posts

    Posted 30 Jul 2020 Link to this post

    Hi Deniz, 

    It is correct that the itemClick event is triggered before the selection of the drawer has been changed. Therefore, it would always return the previously selected item. 

    You could access the currently clicked item via the event arguments:

    var item = e.item

    Is there a specific functionality that you are willing to achieve and the above code snippet would not be applicable there?


    Kind regards,
    Progress Telerik

  3. Deniz
    Deniz avatar
    6 posts
    Member since:
    Jul 2020

    Posted 31 Jul 2020 in reply to Tsvetomir Link to this post


    This is not exactly what I've been looking for but this will help my way to solution.

    Thank you

Back to Top