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 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,553
    Answers
    3931
    Vote Rating
    1272
      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! Checkout the CODE tag!

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

  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,553
    Answers
    3931
    Vote Rating
    1272
      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! Checkout the CODE tag!

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

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
  •