Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interactive Grid custom button Export to excel with GPV Interactive Report/Grid to MSExcel v2

Aouini EmnaJul 2 2024 — edited Jul 2 2024
I added a button in interactive grid toolbar to allow data to be exported to Excel. To do this, I navigated to the Interactive Grid Attributes, then navigated to the Advanced section and inserted the following code in the "JavaScript Initialization Code" box 
function(config) {
var $ = apex.jQuery,
toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),
toolbarGroup = toolbarData.toolbarFind("actions4"), // Ensure this matches your IG toolbar group
customButton = {
type: "BUTTON",
hot: false,
icon: "fa fa-download u-info-text",
iconBeforeLabel: true,
action: "export-to-excel"
};

toolbarGroup.controls.push(customButton);
config.toolbarData = toolbarData;

config.initActions = function(actions) {
actions.add({
name: "export-to-excel",
label: "Télécharger Excel",
action: function(event, focusElement) {
console.log("Button clicked, triggering export event");

// Trigger the GPV plugin action
apex.server.plugin(

"GPV Interactive Report/Grid to MSExcel v2 [plug-In]", // name of the plugin in APEX
{
x01: "hiddenAssembleAsButton" // Interactive Grid's Static ID
}, 
{
dataType: 'json',
success: function(pData) {
console.log("Export success", pData);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error("Export failed", jqXHR, textStatus, errorThrown);
console.log("Response JSON: ", jqXHR.responseJSON);
console.log("Response Text: ", jqXHR.responseText);
}
}
);
}
});
}

return config;
}

the button is added but when clicking the button the export is not delenched
knowing that the plugin is added in plug-ins of shared components with name:GPV Interactive Report/Grid to MSExcel v2

Comments
Post Details
Added on Jul 2 2024
0 comments
399 views