-
2 Aug 2011 3:43 PM #1
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 :
But I do not want to use onItemDisclosure. How can I use listeners/onItemTap/itemtap/ or select to pass 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, onItemDisclosure: function(record){ Ext.dispatch({ controller: 'AFC', action: 'test', data: record.data }) } }); ......
So I want to do something like following but pass record.data to controller :
What can I do?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 }) } } }); ......
-
3 Aug 2011 4:39 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
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 Aug 2011 8:27 AM #3
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 }) } } .....
-
3 Aug 2011 8:28 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
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.


Reply With Quote