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
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    There is an itemtap event.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost 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
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    I would use the getAt method on the store:

    Code:
    dv.store.getAt(idx);
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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