Load extjs using bootstrap.js from outside of extjs app folder

馋奶兔 提交于 2019-12-23 21:23:43

问题


I have built extjs 5 app using sencha cmd and I want to use it in my custom hmtl page. I have the following structure:

extjsapp
    .sencha
    app
    build
    ext
    packages
    ......
    bootstrap.js
    bootstrap.json
    app.js
    .......
customapp
    index.html
    script.js

What I want to do is in my customapp/index.html I request bootstrap.js and it should load all packages and ext from extjsapp folder. By default it tries to load them from customapp/ext which is relative to where boostrap.js is used. How can I make/build it so that it will load ext from extjsapp/ext instead of customapp/ext.

It should be possible to use bootstrap.js from any location to load extjs framework and all required packages that are built in extjs folder.


回答1:


In the app.json file, you'll see an entry about the classpath. This is used to tell Sencha Cmd where your source files are.

Also in that file, you'll see an entry about the indexHtmlPath. This says where the index.html file is.

/**
 * Comma-separated string with the paths of directories or files to search. Any classes
 * declared in these locations will be available in your class "requires" or in calls
 * to "Ext.require". The "app.dir" variable below is expanded to the path where the
 * application resides (the same folder in which this file is located).
 */
"classpath": "${app.dir}/app",
...
/**
 * The file path to this application's front HTML document. This is relative
 * to this app.json file.
 */
"indexHtmlPath": "index.html",

Changing where the ExtJS library is involves editing a hidden file - .sencha/app/sencha.cfg. There's a property in there - ext.dir - that you need to change.



来源:https://stackoverflow.com/questions/24928836/load-extjs-using-bootstrap-js-from-outside-of-extjs-app-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!