Results 1 to 5 of 5

Thread: How to determine the selected item in a List?

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    17

    Default How to determine the selected item in a List?

    Is there a way to get the index number of the selected item in a list?

    Would be nice if there was something like myList.getActiveItemIndex()?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Code:
    var records = list.getSelection();
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    17

    Default

    The documentation says that returns me an array of records. I do not want an array of records, I want to know the index position of the selected record in the list. Basically, did the user click on item 1...5...or 23 in the list.

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Quote Originally Posted by bclover View Post
    The documentation says that returns me an array of records. I do not want the record, I want the index position of the selected record.
    Loop through the array and get the index for each record.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    17

    Default

    Okay thanks, so I guess that means there is no convenience method such as list.getActiveItemIndex() and I must do it manually myself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •