-
15 Feb 2013 5:25 AM #1
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:
Help me please!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
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
store/PchsForms.jsCode://<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(); } } ); } });
view/PchsForm.jsCode: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 } });
model/PhcsForm.jsCode: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 } ] } });
php/json/listaPch.phpCode: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 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) . ');';
?>
-
Best Answer Posted by mitchellsimoens
The proxy and reader type configs need to be all lower case... 'jsonp', 'json'
-
17 Feb 2013 8:07 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
What is Ext.application.views?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Feb 2013 6:19 AM #3
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:
Help me please!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 } ] } });
Thanks
-
18 Feb 2013 8:59 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Feb 2013 12:03 PM #5
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
-
19 Feb 2013 4:56 PM #6
-
20 Feb 2013 7:22 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
The proxy and reader type configs need to be all lower case... 'jsonp', 'json'
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
21 Feb 2013 8:46 AM #8
(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


Reply With Quote