0
votes

At this moment I'm working on an Oracle Apex page, which as one Interactive Report (let it have id my_report) and two checkboxes P1000_FLAG_1 and P1000_FLAG_2, which are related to the former and which help me to select some part of the IR's query. Since Apex doesn't suppose checkboxes to make a submit (what isn't right for radiobuttons), I wrote the Javascript function as a workaround:

/* On change any checkbox */
function toggleQuery(nFlag){
  if(!(nflag > 0 && nFlag < 3)) return;
  sFlag = "P1000_FLAG_" + String(nFlag);
  var nChecked = (document.getElementById(sFlag + "_0").checked ? 1 : 0);
  apex.submit({set:{sFlag:nChecked}});
}

Also I have one process, which executes on load of my page:

/* Process: On Load — Before Header, Once Per Visit Page */
begin
  --initiating several hidden values,
  --which are not changed during working with the page
  :P1000_HIDDEN := GET_HIDDEN(1);
  --...here goes the code, which fills other hidden items...
  --
  --this piece stands for the default choice in current page
  if :P1000_ENTERED is null then
    :P1000_FLAG_1 := 1;
    :P1000_FLAG_2 := 0;
  else
    :P1000_FLAG_1 := nvl(:P1000_FLAG_1,0);
    :P1000_FLAG_2 := nvl(:P1000_FLAG_2,0);
  end if;
  :P1000_ENTERED := 1;
end;

My page works perfectly, when I make only choice by means of the checkboxes. But I have a problem, when I execute one action, which works with the help of AJAX callback and ends with this jQuery command:

$("#my_report").trigger('apexrefresh'); //there is only changing some styles (.css(...)) bound to IR refresh

When I open my page for the first time, do my action and then try to check the second checkbox (which is not checked by default), Apex behaves like I've opened the page again for the first time. I realised this, when I had tried to make all my hidden items unprotected (otherwise I got a error of trying to alter protected hidden items manually).

Thus my question is this: what should I do to make my page work correctly? I use Oracle 11g, Apex 4.2.6.00.03

1
I'm having trouble understanding what you're trying to achieve. What do you mean by "Since Apex doesn't suppose checkboxes to make a submit (what isn't right for radiobuttons)"?Jeffrey Kemp
Jeffrey Kemp, I mentioned that radiobuttons have option "Page action when value changed", which can be equal to "Submit page", and checkboxes don't. My aim is to make my page work well with using the checkboxes, which affect the IR query. It works good, unless I begin to use one JavaScript function (let us call it "myAction"), which ends with the refreshing of my Interactive Report.PiggyInTheMirror
You can refresh the IR in response to a checkbox change with a Dynamic Action that does a Refresh on the IR region. I don't think you need any of the code in your question.Jeffrey Kemp

1 Answers

1
votes

Like Jeffrey said, you can refresh your IG with a dynamic action.

But don't forget to set the items to submit next to your SQL. After the place that you wrote your SQL there is a field "Items to submit", you need to put all items that you are using in your SQL in this field.

After this you can create a dynamic action to refresh the report when some item change.