首页 > 解决方案 > 如何在 Oracle APEX 中的交互式网格属性上使用“多个 JavaScript 函数”

问题描述

当我在交互式网格的属性上使用多个 JavaScript 函数时显示的空白页

我在交互式网格的属性上有一个 JS 函数,一切正常。

//first fuction
function(config) {
    // if there were an option to turn off frozen columns we would do that
    // row header was removed to avoid frozen column but still want multiple select
    config.defaultGridViewOptions = {
        multiple: true,
        selectAll: true
    };
    config.initActions = function(actions) {
        actions.lookup("change-rows-per-page").choices.shift(); // get rid of auto rows per page because that relies on fixed height.
    }
    return config;
}
//here when i add second function like added below my page goes blank
function(config) {
    var toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(), // Make a copy of the default toolbar
        editSaveGroup = toolbarData.toolbarFind( "actions2" );

    // If the employees detail dialog is going to have a Dialog Save button then the
    // save action cannot be hidden (Toolbar Buttons Save unchecked). But rather
    // need to remove the button from the toolbar.
    // If not going to save then all this code can be removed and the 
    // attribute Toolbar Buttons Save unchecked.
    editSaveGroup.controls.pop(); // remove Save button.
    config.toolbarData = toolbarData;
    return config;


    }

我想在 ig 的属性上添加第二个 js 函数,但是当我添加第二个 js 函数时,页面显示空白页。

标签: oracle-apex

解决方案


交互式网格的 JavaScript 初始化代码作为一个回调函数,一旦加载网格就会执行。它是一个单一的 JS 函数。

您必须将两个函数合并为一个函数,如下所示:

function(config) {
    // Make a copy of the default toolbar
    var toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(), 
        editSaveGroup = toolbarData.toolbarFind("actions2");

    // If the employees detail dialog is going to have a Dialog Save button then the
    // save action cannot be hidden (Toolbar Buttons Save unchecked). But rather
    // need to remove the button from the toolbar.
    // If not going to save then all this code can be removed and the 
    // attribute Toolbar Buttons Save unchecked.
    editSaveGroup.controls.pop(); // remove Save button.
    config.toolbarData = toolbarData;
    // if there were an option to turn off frozen columns we would do that
    // row header was removed to avoid frozen column but still want multiple select
    config.defaultGridViewOptions = {
        multiple: true,
        selectAll: true
    };
    config.initActions = function (actions) {
        actions.lookup("change-rows-per-page").choices.shift();
    }

    return config;
}

推荐阅读