1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    45
    Vote Rating
    1
    thantous is on a distinguished road

      0  

    Default Using a Model to load a form

    Using a Model to load a form


    Hiya,

    Previously in Designer, if I sent a json structure that looked like this via a Model load (REST type)

    Code:
    {key1: {advertiserId: 2, ...}, key2: {someOtherId: 1, ...}}
    I could then setup a model by hand and the fields could be specified as 'key1.advertiserId', or 'key2.someOtherId'. In the form, I would have the same nested names associated to specific fields. When loaded, the nested values would pre-fill the form, which was awesome.

    With Architect, I am unable to create a Model field name in the same way. I do have access to the data I need in the raw property, and can set the Model values using this, but that seems like an odd way to handle the problem. Is there a way using Architect that I can create my model names to read the nested structures?

    So, instead of this (cut from Architect)
    Code:
    Ext.define('CampaignManager.model.CampaignModel', {
        extend: 'Ext.data.Model',
        fields: [
            {
                name: 'advertiserId',
                type: 'int'
            },
            {
                name: 'someOtherId',
                type: 'int'
            }
        ]
    });
    I'd like to do this (to match my
    Code:
    Ext.define('CampaignManager.model.CampaignModel', {
        extend: 'Ext.data.Model',
        fields: [
            {
                name: 'key1.advertiserId',
                type: 'int'
            },
            {
                name: 'key2.someOtherId',
                type: 'int'
            }
        ]
    });
    If that isn't possible, what are my options? Is an override useful here? Create multiple models as use associates?

    Thanks,
    Thanatos

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,176
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Sounds like you are looking for the mapping configuration.

    You should set the name to advertiserId and mapping to key1.advertiserId.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    45
    Vote Rating
    1
    thantous is on a distinguished road

      0  

    Default


    Quote Originally Posted by aconran View Post
    Sounds like you are looking for the mapping configuration.

    You should set the name to advertiserId and mapping to key1.advertiserId.
    Ahhhh yes! That works nicely.

    Thanks a ton!
    Thanatous

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..." hd porno faketaxi