【发布时间】:2019-10-03 07:09:33
【问题描述】:
我正在尝试从apex_application_theme_styles 表、theme_roller_config CLOB 列中获取当前主题配置 JSON,并在 JavaScript 函数中使用它。
我使用的代码实现如下:
-
pr_get_theme_config在Processing>Ajax Callback
declare
c_trc_json clob;
c_trc_json_vars clob;
begin
select theme_roller_config into c_trc_json from apex_application_theme_styles where application_id = :APP_ID and upper(IS_CURRENT) like upper('Yes');
apex_json.parse(c_trc_json);
--dbms_output.put_line(apex_json.get_varchar2(p_path => 'vars')); -- for debugging purposes, but prints nothing
end;
-
getThemeConfig函数在Page>JavaScript>Function ... Declaration
function getThemeConfig() {
var themeConfig = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=pr_get_theme_config', &APP_PAGE_ID.);
var themeConfigJson = themeConfig.get();
return themeConfigJson;
}
调用时,getThemeConfig 返回空字符串,但应该返回 JSON。
为了更好地理解,下面是theme_roller_config 内部的示例(在每个\n 被替换为真正的新行之后)
{
"customCSS": "/* custom CSS, should be discarded in this case, cause could contain a large multiline CSS code block */",
"vars": {
"@g_Accent-BG": "#008328",
"@g_Link-Base": "#267373",
"@g_Header-BG": "#007228",
"@g_Accent-OG": "#fafafa",
"@g_Header-FG": "#ddffdd",
"@g_Region-BG": "#ffffff",
"@g_Region-Header-BG": "#007228",
"@g_Nav-BG": "#ffffff",
"@g_Nav-Active-BG": "#aaaaaa",
"@g_Actions-Col-BG": "#ebebeb",
"@g_Body-Title-BG": "#ffffff",
"@l_Left-Col-BG": "#ebebeb",
"@g_Nav-FG": "#dddddd",
"@g_Nav-Active-FG": "#ffffff",
"@g_Button-BorderRadius": "4px",
"@g_Form-BorderRadius": "4px",
"@g_Body-Content-Max-Width": "auto",
"@g_Focus": "#007228",
"@g_Form-Item-BG": "#fefefe",
"@g_Nav-Icon": "#1c1c1f",
"@menu_Tabs-Active-Text": "#0a6a14",
"@g_Container-BorderRadius": "4px",
"@g_Body-BG": "#f0f0f0",
"@l_Button-Primary-BG": "#fd8b43",
"@l_Button-Danger-BG": "#e53835",
"@l_Button-Warning-Text": "#a30b0b",
"@l_Button-Success-BG": "#007228",
"@l_Button-Success-Text": "#ffffff",
"@g_Form-Item-FG": "#3e3e3e",
"@l_Button-Primary-Text": "#5f3100"
}
}
现在,主要问题:
在 IDE 中调试我的 PL/SQL 时如何查看
apex_json.parse过程的结果(在我的例子中,它是PL/SQL Developer)?如何在PL/SQL中访问JSON的
vars属性并将其传递给JavaScript函数?
【问题讨论】:
标签: javascript plsql oracle-apex-5.1