1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    ukraine
    Posts
    13
    Vote Rating
    0
    vladka is on a distinguished road

      0  

    Default Answered: Did belongsto works with dots ?

    Answered: Did belongsto works with dots ?


    Hello everybody.

    BelongsTo don't works with model like: Appname.model.ModelName.
    HTML Code:
    Ext.define('Panda.model.Product',  {   
       extend: 'Ext.data.Model',    
        fields: [        
               { name: 'id',          type: 'int' },        
               { name: 'manifactor_id', type: 'int' },       
               { name: 'name',        type: 'string' }    
        ],    
        associations: [ {  
             type: 'belongsTo',  model: 'Panda.model.Manifactor', 'name' : 'manifactor',
         }]
    });
    two classes to make tests - http://pastebin.com/jE5rkfmW

    Is it possible to make it's works ?

    Or don't use associations at all ?

  2. I use it like this and it works for me:

    Code:
    Ext.define('com.MyApp.model.Document', {   extend: 'Ext.data.Model',
       fields: documentModelMainFields,
       hasMany: {
          model: 'com.MyApps.model.Attribute',
          name: 'attributes'
       }
    });
    
    
    Ext.define('com.MyApp.model.Attribute',{
       extend: 'Ext.data.Model',
       fields: [
          {name: 'id', type: 'float'},
          {name:'name'},
          {name: 'value'},
          {name: 'document_id', type: 'float'}
       ],
       belongsTo: {
          model: 'com.MyApp.model.Document',
          foreignKey: 'document_id'
       }
    
    
    });

  3. #2
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Answers
    4
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default


    I use it like this and it works for me:

    Code:
    Ext.define('com.MyApp.model.Document', {   extend: 'Ext.data.Model',
       fields: documentModelMainFields,
       hasMany: {
          model: 'com.MyApps.model.Attribute',
          name: 'attributes'
       }
    });
    
    
    Ext.define('com.MyApp.model.Attribute',{
       extend: 'Ext.data.Model',
       fields: [
          {name: 'id', type: 'float'},
          {name:'name'},
          {name: 'value'},
          {name: 'document_id', type: 'float'}
       ],
       belongsTo: {
          model: 'com.MyApp.model.Document',
          foreignKey: 'document_id'
       }
    
    
    });

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    ukraine
    Posts
    13
    Vote Rating
    0
    vladka is on a distinguished road

      0  

    Default


    if i change

    HTML Code:
     associations: [        { type: 'belongsTo', model: 'Panda.model.Category' },    ]
    to

    HTML Code:
    belongsTo: {      model: 'Pandora.model.Category',      foreignKey: 'id',      name: 'category',   }
    p = new Pandora.model.Product()
    p.associations.keys - get the right value.

    But how to get a category ?

    p.getCategory - return error function underfined

  5. #4
    Sencha User
    Join Date
    Oct 2011
    Location
    ukraine
    Posts
    13
    Vote Rating
    0
    vladka is on a distinguished road

      0  

    Default


    found getterName parameter in source code belongto.js

    getterName : 'getCategory'.

    thats i needed.

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