1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    52
    Vote Rating
    0
    won.rhee is on a distinguished road

      0  

    Post Ext.List : Pass record data to controller without using onItemDisclosure

    Ext.List : Pass record data to controller without using onItemDisclosure


    Hello All,
    It's probably something simple, but cant seem to figure it out.
    I have a Ext.List with listeners that dispatches to controller.
    If I have onItemDisclosure, I can pass data to controller like this :

    Code:
    .....
            this.list = new Ext.List({
                store: this.store,
                itemTpl: '{StoreCode} : {Name}<br><div class="address">{City}, {State2Code}, {Zip}</div> {distance} mi',
                grouped: false,
                onItemDisclosure: function(record){                
    
                        Ext.dispatch({
                            controller: 'AFC',
                            action: 'test',
                            data: record.data
                            
                        })
                    }
     
            });
    ......
    But I do not want to use onItemDisclosure. How can I use listeners/onItemTap/itemtap/ or select to pass data to controller?

    So I want to do something like following but pass record.data to controller :
    Code:
    .....
            this.list = new Ext.List({
                store: this.store,
                itemTpl: '{StoreCode} : {Name}<br><div class="address">{City}, {State2Code}, {Zip}</div> {distance} mi',
                grouped: false,
                listeners: {
                          select: function(record){
                                  Ext.dispatch({
                                        controller: 'AFC',
                                        action: 'test',
                                        data: record.data
                            
                                   })
                           }
                }
            });
    ......
    What can I do?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Vote Rating
    856
    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


    There is an itemtap event.
    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
    Jun 2011
    Posts
    52
    Vote Rating
    0
    won.rhee is on a distinguished road

      0  

    Post


    Quote Originally Posted by mitchellsimoens View Post
    There is an itemtap event.
    Thanks for that. So below code will at least pass tapped data but wondering there's a better way:

    Code:
    .....
                listeners:{
                    itemtap: function(dv, idx, itm, e){
                        var tapData = dv.store.data.items[idx].data;
                        Ext.dispatch({
                            controller: 'AFC',
                            action: 'test',
                            data: tapData
                            
                        })
                    }
                }
    .....

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Vote Rating
    856
    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


    I would use the getAt method on the store:

    Code:
    dv.store.getAt(idx);
    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