Results 1 to 2 of 2

Thread: How to DataItem Id dynamically

  1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    45
    Vote Rating
    0
      0  

    Default How to DataItem Id dynamically

    Hi,

    I have the same problem in DataItem. Moe specific I am using DataItem inside my DataView.
    The question is:
    1. How to set an Id on each DataItem?
    2. This ID's is dynamically from server.

    My idea is below.

    Code:
    config:{
    		cls: 'kitten-list-item',
    		action: 'freeStyleItem',
    		
    				
    		dataMap:{
    			setItemId: 'id', // This is What I mean. But it does not work, instead the ID was generated by the framework. "ext-layoutfreestyleitem-1"
    
    
    			getImage: {
    				setSrc: 'icon'
    			},
    			getName: {
    				setHtml: 'name'
    			}
    		},
    		image:true,
    		image:{
    			cls: 'x-img',
    			itemId: 'id'
    		},
    		name:{
    			cls: 'x-name',
    			flex: 1
    		}	
    	},
    Here is my JSON file

    Code:
    {
        "widgets": [
            {
                "order": 1,
                "id": "hey-297",
                "name": "Product and Services",
                "description": "Description soon!",
                "icon": "http://vegacrush.com/skyline/img/icongreen_badge.png",
                "edit": "arrow_right"
            },
            {
                "order": 2,
                "id": "296",
                "name": "Sencha touch",
                "description": "Description soon!",
                "icon": "http://skylinetest2.net/project2/assets/js/jquery/uploadify/features/1327899484-sub-icon-sencha-logo.jpg",
                "edit": "arrow_right"
            },
            {
                "order": 3,
                "id": "295",
                "name": "News Update",
                "description": "Description soon!",
                "icon": "http://skylinetest2.net/project2/assets/js/jquery/uploadify/upload/renz_logo.gif",
                "edit": "arrow_right"
            }
    ]
    }

    Please help me guys. Thank you in advanced

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,323
    Vote Rating
    1294
      0  

    Default

    Why would you need to set the id or itemId? You can get the dataitem if you have the index of the record in the store.
    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
  •