比如在工具栏按钮中需要添加一个客户化按钮,点击这个按钮,执行动态操作或者js代码
function (config) {
var $ = apex.jQuery,
// Make a copy of the default toolbar
toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),
/* // Remove the search menu group
toolbarGroup = toolbarData.toolbarRemove("search");
// Remove the reports menu group
toolbarGroup = toolbarData.toolbarRemove("reports");
// Remove the views menu group
toolbarGroup = toolbarData.toolbarRemove("views");
// Remove the actions2 menu group
toolbarGroup = toolbarData.toolbarRemove("actions2");
// Remove the actions3 menu group
toolbarGroup = toolbarData.toolbarRemove("actions3");
// Remove the actions4 menu group
toolbarGroup = toolbarData.toolbarRemove("actions4"); */
// Locate the actions menu group
toolbarGroup = toolbarData.toolbarFind("actions3");
// Add new control elements here
toolbarGroup.controls.push({
type: "BUTTON",
label: "My Button",
icon: "fa fa-american-sign-language-interpreting",
iconBeforeLabel: true,
hot: true,
action: "my_action"
});
toolbarGroup.controls.push({
type: "BUTTON",
label: "My DA Button",
icon: "fa fa-play",
iconBeforeLabel: true,
hot: true,
action: "my_da"
});
config.initActions = function (actions) {
actions.add({
name: "my_action",
action: function () {
apex.submit({request:'P12_APPLY_LOAD',validate:true});
}
});
actions.add({
name: "my_da",
action: function () {
$.event.trigger('my_da');
}
});
}
// Assign new toolbar data back to toolbarData configuration property
config.toolbarData = toolbarData;
// Return the config
return config;
}
参考资料:
https://blogs.ontoorsolutions.com/post/3-ways-to-add-custom-button-in-interactive-grid-oracle-apex/
https://thtechnology.com/2017/07/21/apex-interactive-grid-customize-toolbar/
https://tm-apex.hashnode.dev/customize-your-toolbar-interactive-grid-9