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 delete multiple rows

Leon_MOct 17 2019 — edited Oct 19 2019

Hello Experts,

2 questions in one:

Our users don't like to use Delete Row in sandwich icon in Interactive grid to delete rows.
We had to add checkboxes column to select multiple rows and add Delete button in toolbar.

Capture.PNG

I added checkboxes column and custom Delete button to Toolbar.

First question - Why is first checkbox always checked when page loads (screenshot above)?

I used APEX$ROW_SELECTOR, Row Selector type for checkboxes column. Is there a way NOT to check first row on page load?

Second question - I use 'selection-delete' action for Delete button (code below). It does not delete the row right away. It crosses it and then I have to hit Save button to delete it.

What is correct action to Delete rows right away? I need to define this action in Attributes in JavaScript Initialization Code of the grid (below).

Here is Init code from the grid's Attributes:

function(config) {

//............................................................................

// Subscribe to grid

$("#myIG").on("interactivegridviewmodelcreate", function(event, ui) {

var sid,

    model = ui.model;

if ( ui.viewId === "grid" ) {

    if ( model.instance != null )

      {model.fetchAll(function()  {}); }

      sid = model.subscribe( {

        onChange: function(type, change) {

          var model = get\_model('myIG');

          gridModelEventsPi(change, model, type); 

        }

    } );

}

});

//............................................................................

//Custom button and action

var toolbarData = apex.jQuery.apex.interactiveGrid.copyDefaultToolbar(),

   toolbarGroup = toolbarData\[toolbarData.length - 2\]; // this is the last group with reset button  

 toolbarGroup.controls.push( {

  type: "BUTTON",

  id: "delete-row",

  action: "delete-row"

 });

config.toolbarData = toolbarData;

config.initActions = function( actions ) {

    actions.add( {

      name: "delete-row",

      label: "Delete Row",

      action: function(event, focusElement) {

           var gridId = 'myIG';

          apex.region(gridId).widget().interactiveGrid('getActions').invoke('selection-delete');

      }

  } );   

};      

return config;}

We are in Apex 19.1

Thank you!

Comments
Post Details
Added on Oct 17 2019
3 comments
1,806 views