1. #1
    Sencha User
    Join Date
    Mar 2013
    Location
    India
    Posts
    7
    Vote Rating
    0
    sharikank is on a distinguished road

      0  

    Default Unanswered: unable to display grid with nested json even after using has many

    Unanswered: unable to display grid with nested json even after using has many


    I need to populate my leavehistorygrid with this json but am not able to..what am i doing wrong????

    My store is
    Code:
    Ext.define('AM.store.EMPLeaveRequest', {
        extend: 'Ext.data.Store',
        model: 'AM.model.EMPLeaveRequest',
            autoLoad: true,
         proxy: {
                type: 'ajax',
               
                url: 'data/employeeleave.json',
                autoAppendParams: false,
                reader: {
                    type: 'json'
                    
                         }
            }
    });


    My models are
    Code:
    
    
    
    Ext.define('AM.model.EMPLeaveRequest', {
        extend: 'Ext.data.Model',
        config: {
            fields  : [
                {
                    name : 'ID',
                    type : 'int'
                },
                {
                    name : 'PlAvailedCount'
                }
            ],
            hasMany : [
                {
                    model          : 'AM.model.EMPLeaveHistory',
                    name           : 'LeaveHistory',
                    associationKey : 'LeaveHistory'
                }
            ]
        }
    });
    
    Ext.define('AM.model.EMPLeaveHistory', {
        extend : 'Ext.data.Model',
        config : {
            idProperty : 'ID',
            fields: [{
                name: 'Duration'
            }, {
                name: 'ApprovedBy'
               
            }]
        }
    });

    my json
    Code:
    [
        {
            "ID": 334,
            "PLAvailedCount": "245234",
            "LeaveHistory": [
                {
                    "Duration": 43,
                    "ApprovedBy": "Shyam"
                },
                {
                    "Duration": 53,
                    "ApprovedBy": "Naveen"
                }
            ]
        }
    ]

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Your models shouldn't use the config object
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar