Results 1 to 4 of 4

Thread: How to get the selected record in dataview based on the target ?

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Hyderabad
    Posts
    41
    Answers
    2
    Vote Rating
    0
      0  

    Default Unanswered: How to get the selected record in dataview based on the target ?

    Hi All,

    I've a dataview and when that item is tapped, pushing another view based on the selected dataview item record. Now, Assume that, i don't have item tap event. My question is

    is there any way to get selected item details ( Like record,selectedIndex, etc. ) only using target, element of the tapped area?

    Please suggest me way to achieve this.

    Thanks

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    You can get the index from something like:

    Code:
    dataview.getViewItems().indexOf(target)
    Now you got the index you can get the record from the store

    Code:
    store.getAt(index)
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Hyderabad
    Posts
    41
    Answers
    2
    Vote Rating
    0
      0  

    Default

    @mitchellsimoens,

    Thanks for the reply. dataview.getViewItems().indexOf(target) is useful,if user taps on dataview item. If any image was written in that template, then it is not able to identify the index of the selected region.

    can you suggest update for this?

    Thanks.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    You need to get the top level div for that row using e.getTarget() if the target isn't what you need.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

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