如果您没有找到插件,您可以使用 oracle-jet 甘特图,方法是使用 CDN 直接引用您的 apex 页面上的文件。
1 - 首先将 main.js 文件上传到应用程序的共享组件。他必须遵循这些准则https://docs.oracle.com/middleware/jet400/jet/developer/GUID-219A636B-0D0B-4A78-975B-0528497A82DD.htm#JETDG-GUID-219A636B-0D0B-4A78-975B-0528497A82DD
你的 main.js 看起来像这样:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function _getCDNPath(paths) {
var cdnPath = "";
var ojPath = "";
var thirdpartyPath = "";
var keys = Object.keys(paths);
var newPaths = {};
function _isoj(key) {
return (key.indexOf('oj') === 0 && key !== 'ojdnd');
}
keys.forEach(function(key) {
newPaths[key] = cdnPath + (_isoj(key) ? ojPath : thirdpartyPath) + paths[key];
});
return newPaths;
}
require.config({
paths: _getCDNPath({
'knockout': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/knockout/knockout-3.4.0',
'jquery': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/jquery/jquery-3.1.1.min',
'jqueryui-amd': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/jquery/jqueryui-amd-1.12.0.min',
'ojs': 'https://static.oracle.com/cdn/jet/v4.0.0/default/js/min',
'ojL10n': 'https://static.oracle.com/cdn/jet/v4.0.0/default/js/ojL10n',
'ojtranslations': 'https://static.oracle.com/cdn/jet/v4.0.0/default/js/resources',
'text': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/require/text',
'promise': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/es6-promise/es6-promise.min',
'hammerjs': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/hammer/hammer-2.0.8.min',
'signals': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/js-signals/signals.min',
'ojdnd': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/dnd-polyfill/dnd-polyfill-1.0.0.min',
'css': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/require-css/css.min',
'customElements': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/webcomponents/custom-elements.min',
'proj4js': 'https://static.oracle.com/cdn/jet/v4.0.0/3rdparty/proj4js/dist/proj4'
})
})
requirejs.config({
baseUrl: '',
// Path mappings for the logical module names
paths: {
},
// Shim configurations for modules that do not expose AMD
shim: {
'jquery': {
exports: ['jQuery', '$']
},
'maps': {
deps: ['jquery', 'i18n'],
}
},
// This section configures the i18n plugin. It is merging the Oracle JET built-in translation
// resources with a custom translation file.
// Any resource file added, must be placed under a directory named "nls". You can use a path mapping or you can define
// a path that is relative to the location of this main.js file.
config: {
ojL10n: {
merge: {
//'ojtranslations/nls/ojtranslations': 'resources/nls/menu'
}
}
}
});
2 - 现在您需要在您的页面上加载此文件 (main.js) 和 require.js。为此,请使用“文件 URL”字段。require.js:https ://static.oracle.com/cdn/jet/v4.0.0/3rdparty/require/require.js
3 - 在您的页面标题中,您需要包含以下代码:
<link rel="stylesheet" id="css" href="https://static.oracle.com/cdn/jet/v4.0.0/default/css/alta/oj-alta-min.css">
<script>
if (!document.createElement) {
document.createElement = document.constructor.prototype.createElement;
document.createElementNS = document.constructor.prototype.createElementNS;
document.importNode = document.constructor.prototype.importNode;
}
// The "oj_whenReady" global variable enables a strategy that the busy context whenReady,
// will implicitly add a busy state, until the application calls applicationBoostrapComplete
// on the busy state context.
window["oj_whenReady"] = true;
</script>
4 - 创建一个区域来放置您的 oracle-jet 图表的 html
5 - 最后,创建一个动态动作来有效地创建您的甘特图。动态动作事件是页面加载。它应该运行一个javascript代码。此代码是食谱网站上的文件 demo.js。
前任。https://apex.oracle.com/pls/apex/f?p=145794:23
登录:https ://apex.oracle.com/pls/apex/f?p=4550
workspace: stackquestions
user: test
pwd: test
app: 145794
page: 23
完成这项工作后,您的问题将是如何根据某些过滤器获取数据并更新甘特图。我建议创建一个安静的服务来从你的表中获取这些数据。为此,您将需要一些 javascript 处理以使您的数据遵循 oracle-jet 预期的格式。您可以在 ganttData.json 文件中看到预期的格式。
祝你好运。
我注意到使 oracle-jet 工作所需的 css 文件会干扰页面的 css。我试图使用这个想法将外部 css 的范围限制为仅特定元素?但它并没有完全起作用。