1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    35
    Vote Rating
    0
    manish khamar is on a distinguished road

      0  

    Default display only first tag in list

    display only first tag in list


    Hello
    I parse below json in list.
    --------------------trial.json.----------------------------------------------

    [
    {
    "srno":"0",
    "terabitzid":"176100012257",
    "totalcount":"104",
    "category":"P",
    "pno":"1",
    "sourcename":"",
    "address":"Address Not Available",
    "city":"Reno",
    "state":"NV",
    "zip":"89502",
    "price":"$1,500,000",
    "beds":"0",
    "baths":"0",
    "sqft":"0",
    "broker":"Rustic Realty",
    "agentname":"Joseph",
    "agentemail":"NA",
    "agentphone":"775-356-1222",
    "latitude":"39.5284042",
    "longitude":"-119.8221971",
    "picture":[{"url":"http://img3.terabitz.com/mls/NNRMLS/img/11/000/2696/1.jpg"},
    {"url":"http://img3.terabitz.com/mls/NNRMLS/img/11/000/2696/10.jpg"},
    {"url":"http://img3.terabitz.com/mls/NNRMLS/img/11/000/2696/11.jpg"}]
    }
    ]

    when i parse data in list then it show me all three url in list.
    but i want to get only first url ( http://img3.terabitz.com/mls/NNRMLS/...000/2696/1.jpg).
    so pls help me to solve it.

    code:

    Ext.regModel('User', {
    fields: ['address','city','state','zip','price','beds','baths','sqft','latitude','longitude'],

    hasMany: {model: 'Picture', name: 'picture'},

    });


    Ext.regModel('Picture', {
    fields: ['url'],
    });


    var c = new Ext.data.Store({
    model: 'User',
    autoLoad: true,
    proxy: {
    type: 'ajax',
    url: 'trial.json',
    reader: {
    type: 'json'
    }
    }
    });


    var list = new Ext.List({
    fullscreen: true,
    itemTpl : '<tpl for="."><div class="user"><div>{price}</div><div>{address}</div><div>{city} {state}, {zip}</div><div>{beds} Be | {baths} Ba | {sqft} sqft</div> <tpl for="picture"><div class="pic"><img src="{url}" width="100" height="50" ></div></tpl></div></tpl>',
    store : c,
    singleSelect : 'div.user'
    --------------------
    ----------------------
    ---- rest of the code------
    ----------------------------

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    62
    Vote Rating
    0
    slmd is on a distinguished road

      0  

    Default


    Hi!

    I would suggest you to simply divide your picture tag in 3 as follow
    Code:
    "picture1":"url":"http://img3.terabitz.com/mls/NNRMLS/img/11/000/2696/1.jpg", 
    "picture2":"url":"http://img3.terabitz.com/mls/NNRMLS/img/11/000/2696/10.jpg",
    "picture3":"url":"http://img3.terabitz.com/mls/NNRMLS/img/11/000/2696/11.jpg"
    This way you can use the one you want or all together. It's up you.
    Yours

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    35
    Vote Rating
    0
    manish khamar is on a distinguished road

      0  

    Default


    thanks for reply ,

    I have no rights to change json file and json file can not be changed because this json file is also used for other purpose.

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    6
    Vote Rating
    0
    pulponair is on a distinguished road

      0  

    Default


    Hi,

    did you try something like
    {picture[0].url} or
    {picture.0.url}
    within your template?

    Cheers,
    Nikolas

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    35
    Vote Rating
    0
    manish khamar is on a distinguished road

      0  

    Default


    thanks for reply ,
    Below code is also not working.
    {picture[0].url} or
    {picture.0.url}

  6. #6
    Sencha User
    Join Date
    Mar 2011
    Posts
    6
    Vote Rating
    0
    pulponair is on a distinguished road

      0  

    Default


    Hi,

    sorry my fault:
    {[values.picture[0].url]}

    will do the trick.

    cheers,
    Nikolas

  7. #7
    Sencha User
    Join Date
    Jul 2011
    Posts
    35
    Vote Rating
    0
    manish khamar is on a distinguished road

      0  

    Default


    thanks for reply,

    this is also not working .

    But i have found solution of it myself.

  8. #8
    Sencha User
    Join Date
    Mar 2011
    Posts
    6
    Vote Rating
    0
    pulponair is on a distinguished road

      0  

    Default


    Hey,

    it is working. Try yourself:
    Code:
    	<script>
    
    
    		Ext.setup({
    			onReady: function(){
    				Ext.regModel('listItem', {
    					fields: ['name', 'items']
    				});
    
    
    			var store = new Ext.data.Store({
    				model: 'listItem',
    				data : [
    					{name: 'test', items: [
    						{title: 'a'},
    						{title: 'b'},
    						{title: 'a'}
    					]}
    				]
    			});
    
    
    			var list = new Ext.List({
    				fullscreen: true,
    				itemTpl: '{name} {[values.items[0].title]}',
    				store: store
    			});
    
    
    			list.show();
    			}
    		});
    
    
    	</script>

  9. #9
    Sencha User
    Join Date
    Jul 2011
    Posts
    35
    Vote Rating
    0
    manish khamar is on a distinguished road

      0  

    Default


    thanks ,

    it 's working now

  10. #10
    Sencha User
    Join Date
    Jul 2011
    Posts
    35
    Vote Rating
    0
    manish khamar is on a distinguished road

      0  

    Default


    thanks for help me.

    I have two problem more as below:

    (1)How I can use Slidetoggle like jquery in sencha touch?

    (2)How i can make slideshow for dynamic images or static images?

    it search many time but i still not getting any solution .

    pls help me as soon as possible .

    pls send me reply if u know any answer of above question.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi