1. #1
    Sencha User amarcos3032's Avatar
    Join Date
    Jan 2013
    Location
    Brasil
    Posts
    7
    Vote Rating
    0
    amarcos3032 is on a distinguished road

      0  

    Default Answered: Problems with Sencha Touch / Proxy / PHP and MySQL - Uncaught Error: [Ext.Loader]

    Answered: Problems with Sencha Touch / Proxy / PHP and MySQL - Uncaught Error: [Ext.Loader]


    Hello Friends,
    Help me please!


    My problem is with Sencha Touch / Proxy / PHP and MySQL, the error is:
    Code:
    Failed to load resource: the server responded with a status of 404 (Not Found)http://localhost/myapp/touch/src/application/views.js?_dc=1360902381112
    Uncaught Error: [Ext.Loader] Failed loading'touch/src/application/views.js', please verify that the file exists
    Help me please!


    thank you

    Versions of programs:

    SenchaTouch 2.1.0
    SenchaCmd-3.0.2.288-windows.
    SenchaSDKTools-2.0.0-beta3-windows
    rubyinstaller-1.9.3-p374
    JAVA jdk-7u10-windows-x64
    apache-ant-1.8.4
    xampp-win32-1.7.4-VC6


    My code is:

    app.js
    Code:
    //<debug>
    Ext.Loader.setPath({
        'Ext': 'touch/src',
        'MyAPP': 'app'
    });
    //</debug>
    
    
    Ext.application({
       
        name: 'MyAPP',
    
    
        requires: [
            'Ext.MessageBox'
        ],
    
    
        controllers: ["controle"],   
    
    
        models: [
            "PchsForm"
        ],
    
    
        stores: [
            'PchsForms'
        ],
    
    
        views: [
            'PchsForm'
        ],
    
    
        viewport: {
            layout: {
                type: 'card',
                animation: {
                    type: 'slide',
                    duration: 300
                }
            }
        },
    
    
        icon: {
            '57': 'resources/icons/Icon.png',
            '72': 'resources/icons/Icon~ipad.png',
            '114': 'resources/icons/Icon@2x.png',
            '144': 'resources/icons/Icon~ipad@2x.png'
        },
    
    
        isIconPrecomposed: true,
    
    
        startupImage: {
            '320x460': 'resources/startup/320x460.jpg',
            '640x920': 'resources/startup/640x920.png',
            '768x1004': 'resources/startup/768x1004.png',
            '748x1024': 'resources/startup/748x1024.png',
            '1536x2008': 'resources/startup/1536x2008.png',
            '1496x2048': 'resources/startup/1496x2048.png'
        },
    
        launch: function() {
            // Destroy the #appLoadingIndicator element
            Ext.fly('appLoadingIndicator').destroy();
    
    
            // Initialize the main view
            Ext.Viewport.add(Ext.create('MyAPP.view.PchsForm'));
        },
    
        onUpdated: function() {
            Ext.Msg.confirm(
                "Application Update",
                "This application has just successfully been updated to the latest version. Reload now?",
                function(buttonId) {
                    if (buttonId === 'yes') {
                        window.location.reload();
                    }
                }
            );
        }
    });
    store/PchsForms.js
    Code:
    Ext.define('MyAPP.store.PchsForms',{
        extend: 'Ext.data.Store',
        requires: [
            'Ext.data.proxy.JsonP',
            'Ext.application.views',
            'Ext.data.Store', 
            'Ext.dataview.List'
            //'Ext.Video'
        ],
    
    
        config: {
            model: 'MyAPP.model.PchsForm',
            proxy: {
                type: 'Jsonp',
                api: {
                    create: 'php/json/criaPch.php', //CRUD
                    read: 'php/json/listaPch.php',
                    update: 'php/json/atualizaPch.php',
                    destroy: 'php/json/deletaPch.php',
                },
                
                reader: {
                        type: 'Json', //json or xml
                        
                        //Propriedades para XML
                        root: 'pchs', //Contatos do arquivo XML gerado pelo PHP
                        //record: 'contato' //Registro de Contatos do arquivo XML gerado pelo PHP
                },
                
                writer: {
                        type: 'Json', //json ou xml
                        root: 'pchs',
                        writeAllFields: true,
                        encode: true,
                        allowSingle: true
                }
            },
            
            autoLoad: true,
            autoSync: true
        }    
    });
    view/PchsForm.js
    Code:
    Ext.define('MyAPP.view.PchsForm',{
        
        extend: 'Ext.form.Panel',
        alias: 'widget.pchsform',
        xtype: 'pchsform',
        config: {
            scrollable: true,
            
            defaults: {
                styleHtmlContent: true
            },
    
    
            items: [
                {
                    docked: 'top',
                    xtype: 'toolbar',
                    ui   : 'light',
                    title: 'Input de PCH',
                    itemId: 'toolbarFormInputPch',
    
    
                },
                {
                    docked: 'bottom',
                    xtype: 'toolbar',
                    ui   : 'light',
                    itemId: 'toolbarFormInputPchBtn',
                   
                    defaults: {
                        iconMask: true
                    },
                    items: [
                        { xtype: 'spacer' },
                        
                        { iconCls: 'home',
                            action: 'pchList',
                            ui: 'back'
                        },
                        
                        { 
                            xtype: 'button',
                            action: 'salvaPch',
                            text: 'Salvar'
                           },
    
    
                           { xtype: 'spacer' },
    
    
                    ]
                },
                {
                    xtype: 'fieldset',
                    title: 'Input de PCH',
                                    
                            items: [
                        {
                            xtype: 'textfield',
                            name: 'atratividadeRegiao',
                            label: 'Atratividade da Região'
                        },
                        {
                            xtype: 'textfield',
                            name: 'estado',
                            label: 'Estado'
                        },
                        {
                            xtype: 'textfield',
                            name: 'cidade',
                            label: 'Cidade'
                        }
                    ]
                },
                {
                    xtype: 'container',
                    height: 20
                }
            ]
        }
    
    
    });
    model/PhcsForm.js
    Code:
    Ext.define('WcreatorAPP.model.PchsForm',{
        extend: 'Ext.data.Model',
        config: {
            fields: [
                {name: 'id', type: 'int'},
                {name: 'nome', type:'string'},
                {name: 'atratividadeRegiao', type:'string'},
                {name: 'estado', type:'string'}
            ]
        }    
    });
    php/json/listaPch.php
    PHP Code:
    <?php   
    //connection bd    
    include("connection.php");

    $callback $_REQUEST['callback'];         

    //consulta sql    
    $query mysql_query("SELECT * FROM pchs") or die(mysql_error());         

    //looping array
    $rows = array('pchs' => array());
        
    while(
    $pch mysql_fetch_assoc($query)) {        
           
    $rows['pchs'][] = $pch;    
    }
        
    header('Content-Type: text/javascript');

    //encoda para formato JSON    
    echo $callback '(' json_encode($rows) . ');';

    ?>

  2. The proxy and reader type configs need to be all lower case... 'jsonp', 'json'

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    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


    What is Ext.application.views?
    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.

  4. #3
    Sencha User amarcos3032's Avatar
    Join Date
    Jan 2013
    Location
    Brasil
    Posts
    7
    Vote Rating
    0
    amarcos3032 is on a distinguished road

      0  

    Default Problems with Sencha Touch / Proxy / PHP and MySQL - Uncaught Error: [Ext.Loader]

    Problems with Sencha Touch / Proxy / PHP and MySQL - Uncaught Error: [Ext.Loader]


    Hi mitchellsimoens,


    Sorry, I'm beginner to Sencha Touch.
    I do not understand, "What is Ext.application.views?"

    The code in my view is:

    Code:
    Ext.define('MyAPP.view.PchsForm',{
        
        extend: 'Ext.form.Panel',
        alias: 'widget.pchsform',
        xtype: 'pchsform',
        config: {
            scrollable: true,
            
            defaults: {
                styleHtmlContent: true
            },
    
    
    
    
            items: [
                {
                    docked: 'top',
                    xtype: 'toolbar',
                    ui   : 'light',
                    title: 'Input de PCH',
                    itemId: 'toolbarFormInputPch',
    
    
    
    
                },
                {
                    docked: 'bottom',
                    xtype: 'toolbar',
                    ui   : 'light',
                    itemId: 'toolbarFormInputPchBtn',
                   
                    defaults: {
                        iconMask: true
                    },
                    items: [
                        { xtype: 'spacer' },
                        
                        { iconCls: 'home',
                            action: 'pchList',
                            ui: 'back'
                        },
                        
                        { 
                            xtype: 'button',
                            action: 'salvaPch',
                            text: 'Salvar'
                           },
    
    
    
    
                           { xtype: 'spacer' },
    
    
    
    
                    ]
                },
                {
                    xtype: 'fieldset',
                    title: 'Input de PCH',
                                    
                            items: [
                        {
                            xtype: 'textfield',
                            name: 'atratividadeRegiao',
                            label: 'Atratividade da Região'
                        },
                        {
                            xtype: 'textfield',
                            name: 'estado',
                            label: 'Estado'
                        },
                        {
                            xtype: 'textfield',
                            name: 'cidade',
                            label: 'Cidade'
                        }
                    ]
                },
                {
                    xtype: 'container',
                    height: 20
                }
            ]
        }
    
    
    
    
    });
    Help me please!

    Thanks

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    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


    You are requiring Ext.application.views in the MyAPP.store.PchsForms class and it's trying to load it but is failing. So what is Ext.application.views?
    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.

  6. #5
    Sencha User amarcos3032's Avatar
    Join Date
    Jan 2013
    Location
    Brasil
    Posts
    7
    Vote Rating
    0
    amarcos3032 is on a distinguished road

      0  

    Default


    Hi mitchellsimoens,

    Ext.application.views removed in the MyAPP.store.PchsForms.

    Change with the following error occurs:

    Code:
    Uncaught Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: proxy.Jsonp


    code changed:

    Code:
    Ext.define('MyAPP.store.PchsForms',{
        extend: 'Ext.data.Store',
        requires: [
            'Ext.data.proxy.JsonP',
            'Ext.data.Store'
        ],
    
       config: {
            model: 'MyAPP.model.PchsForm',
            proxy: {
                type: 'Jsonp',
                api: {
                    create: 'php/json/criaPch.php', //CRUD
                    read: 'php/json/listaPch.php',
                    update: 'php/json/atualizaPch.php',
                    destroy: 'php/json/deletaPch.php',
                },
                
                reader: {
                        type: 'Json', //json or xml
                        
                        //Propriedades para XML
                        root: 'pchs', //Contatos do arquivo XML gerado pelo PHP
                        //record: 'contato' //Registro de Contatos do arquivo XML gerado pelo PHP
                },
                
                writer: {
                        type: 'Json', //json ou xml
                        root: 'pchs',
                        writeAllFields: true,
                        encode: true,
                        allowSingle: true
                }
            },
            
            autoLoad: true,
            autoSync: true
        }    
    });

    Help me please.

    Thanks


  7. #6
    Sencha User amarcos3032's Avatar
    Join Date
    Jan 2013
    Location
    Brasil
    Posts
    7
    Vote Rating
    0
    amarcos3032 is on a distinguished road

      0  

    Default


    Help me please.

    Thanks

  8. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    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


    The proxy and reader type configs need to be all lower case... 'jsonp', 'json'
    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.

  9. #8
    Sencha User amarcos3032's Avatar
    Join Date
    Jan 2013
    Location
    Brasil
    Posts
    7
    Vote Rating
    0
    amarcos3032 is on a distinguished road

      0  

    Default (SOLVER) Problems with Sencha Touch / Proxy / PHP and MySQL - Uncaught Error: [Ext.Lo

    (SOLVER) Problems with Sencha Touch / Proxy / PHP and MySQL - Uncaught Error: [Ext.Lo


    Hi mitchellsimoens,

    I changed to lowercase to Json, problem solved.

    thank you very much

Thread Participants: 1

Tags for this Thread