Skip to Main Content

Collapse Interactive Report Control Break

The interactive grid has a feature that collapse and expands the control break. This feature is missing from interactive reports, but it's relatively easy to add the same feature with dynamic action and JavaScript.

First create interactive report and then add dynamic action

  • Event: After Refresh
  • Selection Type: Region
  • Region: {select your interactive report region}
  • Action: Execute JavaScript Code
  • Fire on Initialization: On
  • Code:
    var lButton   = apex.util.htmlBuilder(),
        /* Get messages for button title */
        /* Reusing IG messages */
        lCollapse = apex.lang.getMessage( "APEX.GV.BREAK_COLLAPSE" ),
        lExpand   = apex.lang.getMessage( "APEX.GV.BREAK_EXPAND" )
    ;
    
    /* Prepare button HTML */
    lButton.markup( "<button" )
      .attr( "type", "button" )
      .attr( "aria-expanded", "true" )
      .attr( "title", lCollapse )
      .attr( "aria-label", lCollapse )
      .attr( "class", "t-Button t-Button--noLabel t-Button--icon t-Button--small t-Button--gapRight" )
      .markup( "><span" )
      .attr( "aria-hidden", "true" )
      .attr( "class", "t-Icon fa fa-chevron-down" )
      .markup( "></span></button>" )
    ;
    
    /* Set click event to button */
    var button$ = $( lButton.toString() ).click( function(){
    
      var this$   = $( this ),
          lTitle  = this$.attr( "title" ) == lCollapse ? lExpand : lCollapse
      ;
    
      this$.attr({
        "title": lTitle,
        "aria-label": lTitle,
        "aria-expanded": lTitle == lCollapse ? "true" : "false"
      })
        .children().toggleClass( "fa-chevron-down fa-chevron-right" ).end()
        .closest( "tr" ).nextUntil( ":has(.a-IRR-header--group)" ).toggle()
      ;
    
    });
    
    /* Attach button to IR control break rows */
    $( this.triggeringElement ).find( ".a-IRR-header--group" ).prepend( button$ );
    

Run the page and add a control break from the interactive report action menu.

See working example

Pagination

Comments

No comments yet on this post