Apex v 19.2 (We can't upgrade yet due to client requirements).
I have no idea how to fix this issue.
I have an interactive grid.
If I use the built in delete from the action menu I don't get any errors. But, my requirement is to have a delete button.
I created a custom Delete button using a snippet I found on this blog:
3 ways to Add Custom Button In Interactive Grid Oracle APEX - Ontoor Blogs (ontoorsolutions.com)
The code is in the Javascript Initialization Code in the Attributes for my IG.
The original snippet had all the buttons, but I can use the out of the box Add, Edit and Save buttons. I just need a Delete button as well which isn't available out of the box. So, I stripped out the code for the unneeded buttons.
On entry my IG is empty.
When I click on the built in Add Row 1 row is created - good.
I then click on my custom Delete button created from the code below and the selected row is deleted. - good
Now, I click Add row again and I get this error in the page:
*********************************
Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at Object.arrayEqual (desktop_all.min.js:6)
at a.<computed>.<computed>._select (interactiveGrid.min.js:11)
at a.<computed>.<computed>._select (desktop_all.min.js:27)
at interactiveGrid.min.js:10
********************************
I'm not a javascript guru so I have no idea how to fix the issue or if it's even something I can fix since it seems to be something embedded in the IG that has a conflict related to the custom JS below.
..............................................................................................................
This is the code I am using (copied from the forum example)
function(config) {
let $ = apex.jQuery,
toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),
toolbarGroup = toolbarData.toolbarFind("actions3");
// addrowAction = toolbarData.toolbarFind("selection-add-row"),
// saveAction = toolbarData.toolbarFind("save"),
// editAction = toolbarData.toolbarFind("edit");
toolbarGroup.controls.push({
type: "BUTTON",
action: "selection-delete",
icon: "icon-ig-delete", // alternative FontAwesome icon: "fa fa-trash",
iconBeforeLabel: true,
hot: true
});
config.toolbarData = toolbarData;
return config;
}
ADDITIONAL INFO:
I tried removing the Delete button code and adding code to raise a tooltip in the grid.
I noticed I now get an error if I try to delete the row using the out of the box delete using the same steps above: Add Row, Delete Row (using the built in from the Action item), Add Row - error:
***************************************************
Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at Object.arrayEqual (desktop_all.min.js:6)
at a.<computed>.<computed>._select (interactiveGrid.min.js:11)
at a.<computed>.<computed>._select (desktop_all.min.js:27)
at interactiveGrid.min.js:10
***************************************************
It seems the error is triggered because there is code in the JS Initialization section for the Attribute.