Query execution in the active area

I have one page where I have about 8 tab areas. Each region has a selected status. They are executed while accessing the page (page loading). Since I have 8 selected statuses that execute at the same time, this leads to pure performance. My question is how to execute the request only in the active area.

This is what I need

+5
source share
2 answers

You can try this

  • Create a dynamic action for the Page Load event
  • Create a true action "Run javaScript code":
window.setTimeout(function(){ $('.a-Region-carouselLink').click(function(){ apex.event.trigger(document, 'tabChanged', this); }) }, 500); 
  1. Set Poster Load to Yes
  2. Create custom event "tabChanged"
  3. Create a true action in the DA Custom JavaScript Code Execution event:

    console.log(this.data);

  4. Test it - every time you click a tab, DA prints to the console at the moment, anchored to the anchor.

Of course, it is not ideal due to a delay of 0.5 s. However, it allows you to listen to which tab was clicked.

To make your work in the script, I would do:

  • create page element PX_TAB
  • create a valid action in a custom event to set the value of PX_TAB
  • create valid actions in a custom event to update reports in tabs
  • set "Page Elements to PX_TAB " to " PX_TAB " in each updated report.
  • add a condition to each report comparing the value of the PX_TAB element - it will execute the SQL query only when PX_TAB expects the expected value

edit 08/08/13

You can snap tabs by simply adding a listener to the tabs

 $(document).on('mousedown', 'at-Tabs-link', function(){ //this is an anchor used as tab console.log(this) }) 

If you want to save it on the APEX path, enter the code below in the Execute when Page Loads section or create a new dynamic action On page load

 $(document).on('mousedown', 'at-Tabs-link', function(){ apex.event.trigger(document,'tabChanged', this); }) 

and then add the dynamic action associated with the Custom event named tabChanged . Whenever a tab is clicked, the tabChanged event is fired, and in Execute JavaScript Code you can reference the current tab to this.data

+1
source

Try to create buttons and customize the behavior of each button to display the desired area and hide the others (create a hidden element, then create buttons that specify values ​​1,2,3, etc., then add conditions for each region to display only the area 1 when the hidden element is 1, region 2 for position value 2, etc.

0
source

All Articles