Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

relative paths using extjs 4

My directory structure looks like follows. (i'm using ext mvc )

  • www.mysite.com/ext/designer.js
  • www.mysite.com/ext/app/view
  • www.mysite.com/ext/app/store

I have the js declared here

 <script type="text/javascript" src="http://extjs.cachefly.net/ext-4.0.2a/ext-all-debug.js"></script>
<script type="text/javascript" src="/ext/designer.js"></script>

my issue is that when it calls the store the path is incorrect. "/Jobs/edit/" is the page that contains the js

https://www.mysite.com/Jobs/edit/app/store/JobTypes.js?_dc=1326712425128

So how can i use extjs ( in my existing web application ) so that it will use the correct paths.

here is designer js

Ext.Loader.setConfig({
    enabled: true
});




Ext.application({
    name: 'MyApp',

    stores: [
        'JobTypes',
        'SalesContact',
        'Job',
        'AccountHandlers'
    ],

    launch: function() {
        Ext.QuickTips.init();

        var cmp1 = Ext.create('MyApp.view.Jobs', {
            renderTo: Ext.getBody()
        });
        cmp1.show();
    }
});

I've tried the following after the config but it doesn't seem to override the path.

Ext.Loader.setPath('MyApp', '/Ext/App');
like image 268
frosty Avatar asked Jan 16 '12 11:01

frosty


1 Answers

so you can set the app folder like so .

appFolder: '/ext/app',

Ext.application({
    name: 'MyApp',
    appFolder: '/ext/app',
    stores: [
        'JobTypes',
        'SalesContact',
        'Job',
        'AccountHandlers'
    ],

    launch: function() {
        Ext.QuickTips.init();
        Ext.Loader.setPath('MyApp', '/Ext/App');
        var cmp1 = Ext.create('MyApp.view.Jobs', {
            renderTo: Ext.getBody()
        });
        cmp1.show();
    }
});
like image 196
frosty Avatar answered Oct 25 '22 17:10

frosty