Results 1 to 4 of 4

Thread: Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR: (When i add store)

  1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    2

    Default Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR: (When i add store)

    I take this error when I add my store to the application (MVC):
    W: [Ext.Loader] Synchronously loading 'BTOnline.store.frmBrowserTree'; consider adding Ext.require('BTOnline.store.frmBrowserTree') above Ext.onReady ext-dev.js:8182
    E: XMLHttpRequest cannot load file:///C:/btonline/app/store/frmBro...=1361314901236. Cross origin requests are only supported for HTTP.
    E: Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR: 'app/store/frmBrowserTree.js'; It's likely that the file is either being loaded from a different domain or from the local file system whereby cross origin requests are not allowed due to security reasons. Use asynchronous loading with Ext.require instead.

    Here is the code:

    app.js
    Code:
    Ext.application({
        requires: [
            'BTOnline.view.frmBrowser'
        ],
        //Nombre de la aplicacin.
        name: 'BTOnline',
        models: ['frmBrowserTree'],
        stores: ['frmBrowserTree'],  //i take the error when i add this line
        controllers: ['frmBrowserTree'],
    
    
        /*Cargamos un viewport inicial con todas las views*/
        launch: function() {
            Ext.create('BTOnline.view.frmBrowser');
        }
    });


    stores.js
    Code:
    Ext.define('BTOnline.store.frmBrowserTree', {
        extend: 'Ext.data.TreeStore',
        requires: 'BTOnline.model.frmBrowserTree',   
        model: 'frmBrowserTree',
    
    
        autoLoad: true,
        proxy: {
            type: 'ajax',
            url: 'treeData.json',
        }
    });


    model.js
    Code:
    Ext.define('BTOnline.model.frmBrowserTree', {
        extend: 'Ext.data.Model',
        fields: [{ 
            name: 'text',
            type: 'string'
        }]
    });


    help me, please!!! :/


  2. #2
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Try something like:

    // store
    Code:
    Ext.define('BTOnline.store.frmBrowserTree', {
        extend: 'Ext.data.TreeStore',
        model: 'BTOnline.model.frmBrowserTree',
        ..
    });
    // app.js
    Code:
    Ext.application({
        name        : 'BTOnline',
    
        models      : ['frmBrowserTree'],
        stores      : ['frmBrowserTree'],  
    
        launch: function() { }
    
        autoCreateViewport : true, // load viewport
    
        controllers : ['frmBrowserTree'] // load controller;
    
    });
    // controller
    Code:
    Ext.define('BTOnline.controller.frmBrowserTree', {
        extend : 'Ext.app.Controller',
    
        stores : [ 'frmBrowserTree' ],
        models : [ 'frmBrowserTree' ],
    
        views : [
            'frmBrowser'
        ],
    
    ..
    
    });
    Scott.

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    2

    Default

    Thx scott! but it still doesnt work. (Same error)

    Now i have this:
    (more info)

    app.js
    Code:
    Ext.application({    name: 'BTOnline',
        models: ['frmBrowserTree'],
        stores: ['frmBrowserTree'], //Break loading this line :(
        autoCreateViewport : true,
        controllers: ['frmBrowserTree']
    });
    model.frmBrowserTree
    Code:
    Ext.define('BTOnline.model.frmBrowserTree', {    extend: 'Ext.data.Model',
        fields: [{ 
            name: 'text',
            type: 'string'
        }]
    });
    store.frmBrowserTree
    Code:
    Ext.define('BTOnline.store.frmBrowserTree', {    extend: 'Ext.data.TreeStore',
        model: 'frmBrowserTree',
        //autoLoad: true,
        proxy: {
            type: 'ajax',
            url: 'treeData.json'
        }
    });
    controller.frmBrowserTree
    Code:
    Ext.define('BTOnline.controller.frmBrowserTree', {    extend: 'Ext.app.Controller',
        stores : ['frmBrowserTree'],
        models : ['frmBrowserTree'],
        views: ['frmBrowserTree'],
    
    
        init: function() {
            console.log('Loaded: frmBrowserTree');
        }
    });
    treeData.json (I copied it in the forum, and the model too)
    Code:
    { text: '.',
    children: [{
        text:'Basic Ext Layouts',
        expanded: true,
        children:[{
            text:'Absolute',
            id:'absolute',
            leaf:true
        },{
            text:'Accordion',
            id:'accordion',
            leaf:true
        },{
            text:'Anchor',
            id:'anchor',
            leaf:true
        },{
            text:'Border',
            id:'border',
            leaf:true
        },{
            text:'Card (TabPanel)',
            id:'card-tabs',
            leaf:true
        },{
            text:'Card (Wizard)',
            id:'card-wizard',
            leaf:true
        },{
            text:'Column',
            id:'column',
            leaf:true
        },{
            text:'Fit',
            id:'fit',
            leaf:true
        },{
            text:'Table',
            id:'table',
            leaf:true
        },{
            text:'vBox',
            id:'vbox',
            leaf:true
        },{
            text:'hBox',
            id:'hbox',
            leaf:true
        }]
    },{
        text:'Custom Layouts',
        children:[{
            text:'Center',
            id:'center',
            leaf:true
        }]
    },{
        text:'Combination Examples',
        children:[{
            text:'Absolute Layout Form',
            id:'abs-form',
            leaf:true
        },{
            text:'Tabs with Nested Layouts',
            id:'tabs-nested-layouts',
            leaf:true
        }]
    }]
    }
    My viewport calls an accordion that calls the TreeView. It works without loading the store in app.js.
    I still I have my TreeView without loading my store: (i thought it couldnt be the problem)
    Code:
    Ext.define('BTOnline.view.frmBrowserTree', {/*Arbol de proyectos que est contenido por el acordeon izquierdo
    en el browser*/
        extend: 'Ext.tree.Panel',
        alias: 'widget.frmBrowserTree',
        
        id: 'browserTree',
        title: 'Browser',
    });
    I need help!! I'm doing my final year project in my university with exjs!

    And thx, scott!

  4. #4
    Sencha Premium User
    Join Date
    Jul 2013
    Posts
    15

    Default Maybe it's in the path

    Are you running this from your local disk? Is would be interesting to see your JS include directive .
    I had the same case where I had dynamic loading on, running my page locally and trying to load Sencha's classes dynamically from the CDN.

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
  •