1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Hyderabad
    Posts
    38
    Answers
    2
    Vote Rating
    0
    janardhan pasumarthi is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3461
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    38
    Answers
    2
    Vote Rating
    0
    janardhan pasumarthi is on a distinguished road

      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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3461
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

Thread Participants: 1

Tags for this Thread