Results 1 to 2 of 2

Thread: Modern 6.6 - Why is the model trying to load from outside the app directory?

  1. #1
    Sencha MVP Team Member
    Join Date
    Sep 2016
    Location
    Kennewick, WA
    Posts
    150
    Answers
    15

    Default Answered: Modern 6.6 - Why is the model trying to load from outside the app directory?

    In the code and screenshots below, my question is

    Why is the model trying to load from outside the app directory?

    As the code and screenshots indicate the view model loads as expected from the right path, but the model itself is attempting to be found from the top level path, outside of the app root. Why?
    Model
    Code:
    Ext.define('ezWeb360Mobile.model.empbasicinfomodel', {
        extend: 'Ext.data.Model',
    
    
        fields: [
            { name: 'id', type: 'int' },
            { name: 'firstName', type: 'string' },
            { name: 'lastName', type: 'string' },
            { name: 'address1', type: 'string' },
            { name: 'address2', type: 'string' },
            { name: 'city', type: 'string' },
            { name: 'state', type: 'string' },
            { name: 'zipCode', type: 'string' },
            { name: 'homePhone', type: 'string' },
            { name: 'workPhone', type: 'string' }
        ],
    
    
        proxy: [{
            type: 'ajax',
            api: {
                read: '/dev_andy003/ezWeb360Mobile/resources/mobileTData.aspx?method=getBasicInfo',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                rootProperty: 'data',
                type: 'json'
            },
        }]
    });
    ViewModel
    Code:
    Ext.define('ezWeb360Mobile.view.employee.myinformation.EmployeeBasicInfoModel', {
        extend: 'Ext.app.ViewModel',
        alias: 'viewmodel.employee-myinformation-employeebasicinfo',
        data: {
            name: 'ezWeb360Mobile'
        },
    
    
        stores: {
            basicInfoStore: {
                model: 'ezWeb360Mobile.model.basicinfoempmodel',
                autoLoad: true
            }
        }
    });
    Screen Shot 2019-02-28 at 9.05.06 AM.jpg
    Screen Shot 2019-02-28 at 9.02.46 AM.jpg

    The very same configuration in another project is working perfectly. The different in the projects, the code above is running Modern 6.6 and the code below is running Classic 6.6

    Code:
    Ext.define('ajlfantasy.model.playermodel', {
        extend: 'Ext.data.Model',
    
    
        fields: [
            { name: 'id', type: 'int' },
            { name: 'esbid', type: 'string' },
            { name: 'gsisPlayerId', type: 'string' },
            { name: 'nflPlayerId', type: 'int' },
            { name: 'teamId', type: 'int' },
            { name: 'firstName', type: 'string' },
            { name: 'lastName', type: 'string' },
            { name: 'jerseyNum', type: 'int' },
            { name: 'position', type: 'string' },
            { name: 'height', type: 'string' },
            { name: 'weight', type: 'int' },
            { name: 'age', type: 'int' },
            { name: 'exp', type: 'int' },
            { name: 'college', type: 'string' },
            { name: 'yrentered', type: 'int' },
            { name: 'yearadded', type: 'int' },
            { name: 'yearremoved', type: 'int' },
            { name: 'teamstatus', type: 'int' },
            { name: 'injured', type: 'int' },
            { name: 'injurylength', type: 'string' },
            { name: 'ir', type: 'int' },
            { name: 'practicesquad', type: 'int' },
            { name: 'suspended', type: 'int' },
            { name: 'returnsuspenddate', type: 'date' },
            { name: 'depthchart', type: 'int' },
            { name: 'lineside', type: 'string' }
        ],
    
    
        proxy: {
            type: 'ajax',
            api: {
                read: '/resources/players.php?method=getTeamRoster',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                type: 'json',
                rootProperty: 'players'
            }
        }
    });
    Code:
    Ext.define('ajlfantasy.model.playermodel', {
        extend: 'Ext.data.Model',
    
    
        fields: [
            { name: 'id', type: 'int' },
            { name: 'esbid', type: 'string' },
            { name: 'gsisPlayerId', type: 'string' },
            { name: 'nflPlayerId', type: 'int' },
            { name: 'teamId', type: 'int' },
            { name: 'firstName', type: 'string' },
            { name: 'lastName', type: 'string' },
            { name: 'jerseyNum', type: 'int' },
            { name: 'position', type: 'string' },
            { name: 'height', type: 'string' },
            { name: 'weight', type: 'int' },
            { name: 'age', type: 'int' },
            { name: 'exp', type: 'int' },
            { name: 'college', type: 'string' },
            { name: 'yrentered', type: 'int' },
            { name: 'yearadded', type: 'int' },
            { name: 'yearremoved', type: 'int' },
            { name: 'teamstatus', type: 'int' },
            { name: 'injured', type: 'int' },
            { name: 'injurylength', type: 'string' },
            { name: 'ir', type: 'int' },
            { name: 'practicesquad', type: 'int' },
            { name: 'suspended', type: 'int' },
            { name: 'returnsuspenddate', type: 'date' },
            { name: 'depthchart', type: 'int' },
            { name: 'lineside', type: 'string' }
        ],
    
    
        proxy: {
            type: 'ajax',
            api: {
                read: '/resources/players.php?method=getTeamRoster',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                type: 'json',
                rootProperty: 'players'
            }
        }
    });
    Now could this point to a bug in Modern 6.6 and creating stores in this fashion?
    Last edited by aallord; 28 Feb 2019 at 9:39 AM. Reason: Added code for Classic 6.6 that is working as expected.
    Andy Allord
    Sencha MVP/Software Engineer

  2. Found the problem.

    Code:
    proxy: [{
            type: 'ajax',
            api: {
                read: '/dev_andy003/ezWeb360Mobile/resources/mobileTData.aspx?method=getBasicInfo',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                rootProperty: 'data',
                type: 'json'
            },
        }]
    Needs to be

    Code:
    proxy: {
            type: 'ajax',
            api: {
                read: '/dev_andy003/ezWeb360Mobile/resources/mobileTData.aspx?method=getBasicInfo',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                rootProperty: 'data',
                type: 'json'
            },
        }
    Proxy is an object and was defined as an array.

  3. #2
    Sencha MVP Team Member
    Join Date
    Sep 2016
    Location
    Kennewick, WA
    Posts
    150
    Answers
    15

    Default

    Found the problem.

    Code:
    proxy: [{
            type: 'ajax',
            api: {
                read: '/dev_andy003/ezWeb360Mobile/resources/mobileTData.aspx?method=getBasicInfo',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                rootProperty: 'data',
                type: 'json'
            },
        }]
    Needs to be

    Code:
    proxy: {
            type: 'ajax',
            api: {
                read: '/dev_andy003/ezWeb360Mobile/resources/mobileTData.aspx?method=getBasicInfo',
                create: '',
                update: '',
                destroy: ''
            },
            writer: {
                type: 'json',
                writeAllFields: true
            },
            reader: {
                rootProperty: 'data',
                type: 'json'
            },
        }
    Proxy is an object and was defined as an array.
    Andy Allord
    Sencha MVP/Software Engineer

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •