1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    29
    Vote Rating
    0
    v2108 is on a distinguished road

      0  

    Default How to fill textfields with store

    How to fill textfields with store


    Hi guys,

    I want to fill textfields with an json File, using a Model and a store.
    How does this work in Sencha Architect. How should the json-file look like?

    Please help

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    11
    Vote Rating
    0
    CX2 is on a distinguished road

      0  

    Default


    Are you creating a Touch or Ext project in Architect?

    Here is a quick reference

    MODEL
    Code:
    Ext.define('V.model.UserModel', {    
    extend: 'Ext.data.Model',
        config: {
            fields: [
                {
                    name: 'AssignedToID',
                    type: 'int'
                },
                {
                    name: 'UName',
                    type: 'string'
                },
                {
                    name: 'FirstName',
                    type: 'string'
                },
                {
                    name: 'LastName',
                    type: 'string'
                },
                {
                    name: 'UserEmail',
                    type: 'string'
                }
            ],
            proxy: {
                type: 'ajax',
                url: 'https://yourserver/json.file',
                reader: {
                    type: 'json'
                }
            }
        }
    });
    STORE
    Code:
    Ext.define('V.store.UserStore', {    
    extend: 'Ext.data.Store',
        requires: [
            'V.model.UserModel'
        ],
    
    
        config: {
            autoLoad: false,
            model: 'V.model.UserModel',
            storeId: 'userstore'
        }
    });
    JSON DATA
    Code:
    [{"AssignedToID":1,"UName":"c","FirstName":"c","LastName":"h","UserEmail":"c@c.ca"},{"AssignedToID":2,"UName":"t","FirstName":"t","LastName":"b","UserEmail":"t@t.com"},{"AssignedToID":3,"UName":"b","FirstName":"b","LastName":"a","UserEmail":"b@b.com"},{"AssignedToID":4,"UName":"t","FirstName":"t","LastName":"h","UserEmail":"t@t.com"}]

    Here is some code that fills in a forms fields based on the list item selected.

    Code:
    onUserListItemTap: function(dataview, index, target, record, e, options) {       
            var Viewport = Ext.getCmp('viewport');
            var UserForm = Ext.getCmp('userForm');
            var UserModel = Ext.getStore('userstore').getAt(index);
            UserForm.setRecord(UserModel);
            Viewport.animateTo('left');
            Viewport.setActiveItem(UserForm);
        }
    Hope that helps a bit.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    29
    Vote Rating
    0
    v2108 is on a distinguished road

      0  

    Default


    Thank you for your answer. I am developing an Sencha Architect Application. It works

Thread Participants: 1

Tags for this Thread

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