Skip to Main Content

DevOps, CI/CD and Automation

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!

oj-button action: how to prevent page refresh

RTSMay 24 2019 — edited May 27 2019

Hello there,

i am currently in the process of developing an ApEx region plugin based on Oracle Jet charts.

It contains an oj-legend that should be resetted by a button because it has many items.

The filtered items are tracked via Knockout's ObservableArray (pretty standard cookbook stuff: https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=chart&demo=filtering).

So the problem is, the reset button (oj-button) always refreshes the page.

The button is inserted into the DOM by PL/SQL code:

sys.htp.p('<oj-button id="legend_reset_button" type="button" on-oj-action="[[resetButtonClick]]">Reset Filters</oj-button>');

And the JavaScript function behind resetButtonClick is:

// Reset Button sets the hiddenCategoriesValue OA to empty which in turn triggers the onChange event

self.resetButtonClick = function(event){

    event.preventDefault();  // does not help

    self.hiddenCategoriesValue([]);

    return false; // does not help

}

Is it possible to prevent this page refresh (or maybe page submit) from happening?

There must be something I'm missing when configuring the button & event function.

Thanks in advance

René

Comments
Post Details
Added on May 24 2019
4 comments
540 views