If you want to share a resource, it should be put in the resources
folder of your application as follows:
home-app
|- app
|- Application.js
|- model
|- store
|- view
|- resources <- HERE
|- menu.json
|- data.xml
|- logo.png
Do not forget to execute the sencha app build development
(or production
) command.
After successful build, the resource URL will be accessible via the poorly documented Ext.getResourcePath
function:
{
xtype: "treepanel",
title: "Menu",
store: {
type: "tree",
proxy: {
type: 'ajax',
url: Ext.getResourcePath('menu.json'),
reader: {
type: 'json',
rootProperty: 'children'
}
},
root: {
expanded: true,
text: "Examples"
}
}
}