1. #1
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    125
    Vote Rating
    0
    Answers
    1
    JavascriptParrot is on a distinguished road

      0  

    Question Unanswered: Model convert field, hasMany properties empty?

    Unanswered: Model convert field, hasMany properties empty?


    Hello all,

    I have the follow model, but when I try to get the data of PI I got an empty set back. I have the same problem in one of my controllers. Using a mapping to PI.suts works fine, but I need also the first item from PI.p

    PHP Code:
    Ext.define('app.model.Artikel', {    
    extend'Ext.data.Model',    config: {
            
    fields: [
                { 
                   
    name'Nr',
                    
    type'int'
                
    },
                {
                    
    name'Nm',
                    
    type'string'
                
    }, {
                    
    name'Test',
                    
    type'String',
                    
    mapping'PI.suts' //THIS WORKS FINE!!
                
    },
                {
                    
    name'Sample',
                    
    convert: function(vrecord) {
                        
    //return record.PI() the length off data is 0
                      //how to get the first p from PI
                    
    }
                }
            ],
            
    hasMany: {
                
    name'PI',
                
    model'app.model.EenheidInformatie'
            
    }
        } 
    The model using for the hasMany
    PHP Code:
    Ext.define('iperenMobile.model.EenheidInformatie', {
        
    extend'Ext.data.Model',
        
    config: {
            
    fields: [
                {
                    
    name'sut',
                    
    type'string'
                
    },
                {
                    
    name'suts',
                    
    type'string'
                
    },

            
    hasMany: {
               
    name'p',
               
    model'app.model.Eenheid'
           
    }

            ],
        }}); 
    PHP Code:
    Snippet from controller
    onSomeListTap
    : function(list, record){
        var 
    data record.raw.Products//array using in a list
        //here record.Products() data array is empty

    What is going wrong with the hasMany fields in the model, what I'm doing wrong? I hope you understand what I mean. It's hard to me to explain and write it down in readable English.

    Thanks,
    Gertjan
    -->

  2. #2
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    125
    Vote Rating
    0
    Answers
    1
    JavascriptParrot is on a distinguished road

      0  

    Default


    Update: when I try to get the hasOne from record I got.

    PHP Code:
    record.getHasOne()
    null 
    Hope someone help me...
    -->

Tags for this Thread