1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    greg_prop is on a distinguished road

      0  

    Default Unanswered: how to display jason data in textfield

    Unanswered: how to display jason data in textfield


    hi!
    i am using following code to fetch data using JsonStore but unable to display it in textfield, although it is being displayed in drop down.

    var prices = new Ext.data.JsonStore({
    autoDestroy: true,
    url: 'transport.php?controller=templates&action=getPrice&propid=' + recId,
    root: 'prices',
    id: 'propprice',
    fields: ['propertyID','price']
    });

    and following for textfield in toolbar.

    {
    xtype: 'textfield',
    name: 'textfield1',
    id:'textfield1',
    fieldLabel: 'Text field',
    value: prices

    }
    it displays "[object Object]"in textfield, i have tried prices[0] and prices['price'] as well in this case nothing is displayed.
    Can anyone please help me on this?

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi Greg,

    var prices = new Ext.data.JsonStore({
    })
    JsonStore return Store object, if root prices contain an array of item then you can fill text field by -
    Code:
    value = prices.data.items[0]
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    greg_prop is on a distinguished road

      0  

    Default


    Thanks for help but issue is still there.I have tried this as well but nothing is displayed. When i use to write "value=prices.price[0]" the window in which this calculation is being performed, even window does not appear.

  4. #4
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    See this sample example-
    Code:
    var myStore = new Ext.data.JsonStore({
        fields:['name', 'phone'],
        data:{'detail':[
            { 'name': 'Lisa', "phone":"555-111-1224"  },
            { 'name': 'John', "phone":"500-111-1224"  }        
        ]},
        proxy: {
            type: 'memory',
            reader:{
                root:'detail'
            }     
        }     
    });
    
    Ext.create('Ext.FormPanel', {
        width: 500,
        renderTo:Ext.getBody(),
        title: 'Panel',
        items: [{
            xtype: 'textfield',
            fieldLabel: 'Name',
            value:myStore.data.items[0].data.name
        }]
    });
    for your form field try this -
    Code:
    value : prices.data.items[0].data.price
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  5. #5
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    greg_prop is on a distinguished road

      0  

    Default


    This can done if we have static data but i am fetching data from database.

Thread Participants: 1

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..."