admin管理员组

文章数量:1125609

  1. Created a new (very simple) APEX application, three pages only: Global, Home and Login.

  2. Modified the Home page to allow public access.

  3. Created a Blank Page, Breadcrumbs off, Use Navigation set to on.

  4. On the Home page: created a region with one page item (P1_NEW)

  5. Modified P1_NEW to have a default static value of ‘ABC’

  6. Shared Components / Navigation Menu / Conditions for the Home entry, set the condition to ‘Function Body Returning a boolean’ and entered the following:

         BEGIN
    IF :P1_NEW = 'ABC' THEN
            return true;
    ELSE
        return false;
        END IF;
        END;
    
  7. Re-ran the application, the menu entry for the Home page was not displayed - it should have been.

  8. Created a new Home page item: P1_NEW_1, set server side condition for this item to ‘Function Body’ and inserted the code as detailed above and P1_NEW_1 was visible - as you would expect.

  9. Changed default value of P1_NEW to ‘ABCD’, re-ran the application and P1_NEW_1 did not display – as you would expect.

  10. I’m probably missing something very obvious but why doesn’t this condition work when applied to a menu item?

APEX product build is 24.1.5

Actions are detailed above. Given that the boolean function returned TRUE, menu entry for the Home page should display but did not.

  1. Created a new (very simple) APEX application, three pages only: Global, Home and Login.

  2. Modified the Home page to allow public access.

  3. Created a Blank Page, Breadcrumbs off, Use Navigation set to on.

  4. On the Home page: created a region with one page item (P1_NEW)

  5. Modified P1_NEW to have a default static value of ‘ABC’

  6. Shared Components / Navigation Menu / Conditions for the Home entry, set the condition to ‘Function Body Returning a boolean’ and entered the following:

         BEGIN
    IF :P1_NEW = 'ABC' THEN
            return true;
    ELSE
        return false;
        END IF;
        END;
    
  7. Re-ran the application, the menu entry for the Home page was not displayed - it should have been.

  8. Created a new Home page item: P1_NEW_1, set server side condition for this item to ‘Function Body’ and inserted the code as detailed above and P1_NEW_1 was visible - as you would expect.

  9. Changed default value of P1_NEW to ‘ABCD’, re-ran the application and P1_NEW_1 did not display – as you would expect.

  10. I’m probably missing something very obvious but why doesn’t this condition work when applied to a menu item?

APEX product build is 24.1.5

Actions are detailed above. Given that the boolean function returned TRUE, menu entry for the Home page should display but did not.

Share Improve this question edited yesterday MT0 168k11 gold badges66 silver badges127 bronze badges asked 2 days ago PhilPhil 112 bronze badges New contributor Phil is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

2 Answers 2

Reset to default 1

By the page is rendered, all the server-side conditions executed first. Then, when conditions are met, some regions, items etc. are displayed.

In your case, navigation menu is a system wide component in terms of DOM structure and when the condition is checked, it is already rendered.

I suggest you use client-side conditions or create a application item not a page item.

It doesn't work because at the time the Nav Menu is rendered, the page item does not have it's value set yet. Instead of using the "default" attribute of the page item, create a computation on the item with a before header execution point. That way the value is set before the nav menu is rendered. I never use the default attribute for exactly that reason.

To ensure the behaviour of the computation is what you'd expect of a default value, set a serverside condition of "Item is NULL" on it.

off topic: The serverside condition can just be type "Expression" with source :P1_NEW = 'ABC'. Same result but less typing ;)

本文标签: Oracle Apex Navigation Menu – Conditions questionStack Overflow