Build beautiful and interactive API documentation for ORDS

Image
In this blog post, I will show you how to quickly build beautiful and interactive API documentation for your Oracle APEX REST data sources using  swagger hub . Using APEX v23.1. I downloaded the  titanic data set  and loaded them into tables in my APEX instance, created some authorized restful services and published them using swagger hub. You can create a free account on swagger hub.   Check out my titanic swagger hub here ; Press Authorize. Username REST, password Glasgow123! I won't go through creating RESTful services and just show you the four I created that sit on top of the titanic data set; The GET is a very simple SQL query;      select * from TITANIC_DATA_SET_NEW A handy tip is to add comments, as there will appear on swagger hub, making your API self documenting; Once you have created your modules, press the Generate Swagger Doc button; This will generate an open API for you.  Copy the API and paste it into swagger hub This will generat...

Highlight min and max column values in an Interactive Report

Highlight maximum and minimum column values in an Interactive Report (or grid) with a couple of lines of JavaScript and CSS.

Demo


Create an Interactive Report region (static ID IR_STATIC_ID) with the following source SQL;

select 'Product 1' as PRODUCT100 as VALUE_1200 as VALUE_2121 as VALUE_3 from DUAL
UNION
select 'Product 2' as PRODUCT103 as VALUE_1140 as VALUE_299 as VALUE_3 from DUAL
UNION
select 'Product 3' as PRODUCT1 as VALUE_12 as VALUE_2120 as VALUE_3 from DUAL
UNION
select 'Product 4' as PRODUCT10 as VALUE_17 as VALUE_2124 as VALUE_3 from DUAL
UNION
select 'Product 5' as PRODUCT432 as VALUE_1632 as VALUE_2134 as VALUE_3 from DUAL
UNION
select 'Product 6' as PRODUCT34 as VALUE_1333 as VALUE_2166 as VALUE_3 from DUAL

Add this to execute when page loads;

$(function(){
    var cols = []
    var trs = $('#IR_STATIC_ID tr')
    var data =$.each(trs , function(indextr){
      $.each($(tr).find("td").not(":first"), function(indextd){
        cols[index] = cols[index] || [];
        cols[index].push($(td).text())
      })
    });
    cols.forEach(function(colindex){
      var max = Math.max.apply(nullcol);
      var min = Math.min.apply(nullcol)
      $('#IR_STATIC_ID tr').find('td:eq('+(index+1)+')').each(function(itd){
        $(td).toggleClass('u-color-1-text', +$(td).text() === max)
        $(td).toggleClass('u-color-2-text', +$(td).text() === min)  
      })
    })
  })

Inline CSS, change this to suit.

.u-color-1-text{
    font-weight700;
    font-sizelarger;
}
    
.u-color-2-text{
    color:red !Important;
    font-weight500;
    font-sizelarger;
}

Your grid min and max values will now be highlighted.

Comments

Popular posts from this blog

Oracle APEX Interactive Grid colour cells based on a condition using JavaScript and CSS

Oracle APEX style an Interactive Grid cell conditionally based on the value of another cell using JavaScript and CSS

Oracle APEX Color Interactive Grid (IG) group header using CSS