PDA

View Full Version : relative paths using extjs 4



Anthony.Hall
16 Jan 2012, 6:42 AM
Hi all, i'm calling the wrong url for the store. I would appreciate setting up my paths.


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


www.mysite.com/ext/designer.js (http://www.mysite.com/ext/designer.js)
www.mysite.com/ext/app/view (http://www.mysite.com/ext/app/view)
www.mysite.com/ext/app/store (http://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


So it call this file


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


When i want this file


https://www.mysite.com/ext/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.

Anthony.Hall
16 Jan 2012, 8:05 AM
you can set the app folder in the application declaration. like so

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();
}
});