Results 1 to 4 of 4

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

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    52
    Vote Rating
    0
      0  

    Post 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Vote Rating
    1296
      0  

    Default

    There is an itemtap event.
    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
    Jun 2011
    Posts
    52
    Vote Rating
    0
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Vote Rating
    1296
      0  

    Default

    I would use the getAt method on the store:

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