-
31 Aug 2010 5:09 AM #1
Add event in item list
Add event in item list
Hi, I'm new here. I've got some problems with a list. I read that nested list can't join with stores. So I made this code with a simple list:
The list work correctly!! When I click an item of the list I want to enter into another page that shows me a list of details that arrives me from the array. (for example with nested list, with that I can make it manually) How can I make it dynamically?Code:Ext.setup({ icon: THECA_WEB + 'images/xxx.png', tabletStartupScreen: THECA_WEB + 'images/tablet_startup.png', phoneStartupScreen: THECA_WEB + 'images/phone_startup.png', glossOnIcon: false, onReady: function() { Ext.regModel('Page', { fields: ['id', 'title'] }); var s = new Ext.data.JsonStore({ autoLoad: true, model: 'Page', proxy: { type: 'ajax', url: 'http://localhost/touch_test/test/getpagine/', reader: { type: 'json', root: 'pagine' } } }); var list = new Ext.List({ fullscreen: true, tpl: '<tpl for="."><div class="x">{title}</div></tpl>', itemSelector: '.x', store: s }); } });
-
31 Aug 2010 5:13 AM #2
On your list, add an itemtap listener:
Code:list.on('itemtap', function(list, index, item, e){ var rec = list.store.getAt(index); console.log(rec.get('title')); // do something here });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
31 Aug 2010 5:28 AM #3
Perfect, thank you.
Now I need to show an edit form on the itemtap event you just suggested me.
Which is the best way to achieve this?
I mean, i know how to connect to server logic with stores and models,
but i cannot figure out how to link different "views" to different events..
thanks for your help
Nicola
-
31 Aug 2010 5:29 AM #4
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Similar Threads
-
Add components to list item instead of template html
By meyerovb in forum Sencha Touch 1.x: DiscussionReplies: 2Last Post: 10 Aug 2010, 3:56 PM -
sample code to wire ontap event to a template list item?
By profunctional in forum Sencha Touch 1.x: DiscussionReplies: 2Last Post: 7 Jul 2010, 11:17 AM -
Dynamically add an item to a list
By meyerovb in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 1 Jul 2010, 11:33 AM -
add item not in combobox list
By iceblast_01 in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 4 Dec 2008, 8:21 PM



Reply With Quote