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 buttons to delete/add specific rows

A_ce1Oct 3 2022

I need help with my interactive grid, can't figure out how to delete only the one before last row of editionable grid in a table after clicking a button.
One before last row because last row is a row with summary where I am gonna use:

defaultGridColumnOptions = {
    aggregates: ["SUM"]

I need a functionality that will allow users to delete only the one before last row in an IG, no matter which row they select in an IG. Adding new rows should work the same, adding new rows as one before last row position of an IG.
To create buttons I used below code:


function(config) {
  let $             = apex.jQuery,
      toolbarData   = $.apex.interactiveGrid.copyDefaultToolbar(), // Copy the default toolbar
      toolbarGroup = toolbarData.toolbarRemove("edit");
      toolbarGroup = toolbarData.toolbarRemove("selection-add-row");
      toolbarGroup  = toolbarData.toolbarFind("actions3"); // Get the group you want to put your controls into
   
    toolbarGroup.controls.push({
                            type: "BUTTON",
                            action: "selection-add-row",
                            label :"Add row",
                            id: "add_info",
                            icon: false,
                            iconBeforeLabel: true,
                            disabled: false
                        });
    
    toolbarGroup.controls.push({type: "BUTTON",
                            id: "delete",
                            label: "Delete row",
                            icon: false, //or icon: "icon-ig-delete"
                            iconBeforeLabel: true,
                            //iconOnly: true,
                            //hot: true,
                            //class: "a-Button-label"
                            disabled: false,
                            action: "selection-delete"
                         });

    
  config.toolbarData = toolbarData;
  return config;
}
I created an application:
https://apex.oracle.com/pls/apex/f?p=4550:1
Workspace: ig_buttons
User - TEST
Pass - IGtestAPEX
This post has been answered by Hamza Al-abbasi on Oct 3 2022
Jump to Answer
Comments
Post Details
Added on Oct 3 2022
6 comments
1,786 views