Results 1 to 4 of 4

Thread: Add event in item list

  1. #1
    Ext User El Turcky's Avatar
    Join Date
    Aug 2010
    Location
    Gradisca d'Isonzo (ITALY)
    Posts
    2
    Vote Rating
    0
      0  

    Default 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:
    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
            });
    	}
    });
    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?

  2. #2
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,984
    Vote Rating
    933
      0  

    Default

    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
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Ext User El Turcky's Avatar
    Join Date
    Aug 2010
    Location
    Gradisca d'Isonzo (ITALY)
    Posts
    2
    Vote Rating
    0
      0  

    Default

    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

  4. #4
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,984
    Vote Rating
    933
      0  
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Similar Threads

  1. Add components to list item instead of template html
    By meyerovb in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 10 Aug 2010, 3:56 PM
  2. sample code to wire ontap event to a template list item?
    By profunctional in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 7 Jul 2010, 11:17 AM
  3. Dynamically add an item to a list
    By meyerovb in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 1 Jul 2010, 11:33 AM
  4. add item not in combobox list
    By iceblast_01 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 4 Dec 2008, 8:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •