Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

OBIEE Dashboard tabs Color & Font Change

Received Response
382
Views
4
Comments
Steelbird
Steelbird Rank 4 - Community Specialist

Hi, Is there a way to implement dashboard tab color & font change in Oracle Business Intelligence 12.2.1.4.0 version. I tried in three methods but none of them worked out. I want to change only to particular dashboard like Supply chain and not for entire dashboard . Can some one give me solution @Gianni Ceresa.

First Method:

Each tab is defined by two classes in OBIEE . One is .secondaryTabEnabled and other is  .secondaryTabSelected and tabs are part of table id = dashboard_page_x_tab (where x starts at 0 to define starting tab) and the corresponding spans are as below. Actually we will inspect on dashboard page to get dashboard page tab & page name. So, to change the text color of first tab, I have added below code in 2nd tab in a Text components in dashboard layout and marked it as HTML Mark-up

<script>

var span1=document.querySelector('#dashboard_page_0_tab span');

span1.innerHTML='<font color="#84B761">Page1</font>';

</script>

So what we did here is, called the JavaScript native querySelector function to find the id of the 1st tab/page and replace the innerHTML of the span element with custom change that we want to implement. To remove that tiny expand/collapsible button, just added display: none; in Dashboard layout section properties.

#dashboard_page_0_tab - Dashboard Tab name

Page1 – Dashboard page Name

Second Method:

The script below allows the Tabs on a dashboard to be coloured in different colours.

Added the below code in a Textbox into a dashboard "Contains HTML"

<script type="text/javascript">

var tblId=document.getElementById('dashboard_page_0_tab');

  1. tblId.tBodies[0].rows[0].cells[1].className='';
  2. tblId.tBodies[0].rows[0].cells[1].style.backgroundColor='red';

</script>

dashboard_page_0_tab – Dashboard tab Name.

Third Method:

I tried to change the font name in different approach. This is not Java script.

Selecting dashboard page name and go to rename option paste [<font color=blue> pagename </font>].In my case pagename is Page1.

I am expecting in that below format.

Screenshot_4.png

Thank you.

Tagged:

Answers

  • afb86a01-119f-4e75-b10a-e20095835f3f wrote:I want to change only to particular dashboard like Supply chain and not for entire dashboard .

    That's a bit confusing: you want to change things for a particular dashboard but not the entire dashboard? So you want those colors to be visible only when on a given page of your dashboard?

    OBIEE 12c is heavily event-based, there are events handlers attached to almost everything in the GUI. It isn't the safest way to play with .innerHTML, as what you look for is styling, stick to CSS: it allows you to change the visual appearance of things without affecting events and the DOM structure.

    You have jQuery available by default, so you can really do nice things.

    Also keep in mind the fact that any custom code you add to a dashboard page will need to be present in every other page as well. I doubt the dashboard load the code of every page by default as that would also fire queries in all the directions. Only the selected page is selected, therefore you need to repeat that code in all the pages where you want to see the result.

    Did you use your browser developer toolbar to set the appropriate CSS to get the expected result? Did you try to turn it into the most generic code possible to work on your dashboard?

    You talk about 3 methods but no info on what happened with the 3.

    Also keep in mind that any JS code you add must be executed only once the document is ready. Code entered directly like that could be executed before the elements you try to affect exist in the page itself. You can use the log in the console to debug things, to see if the code is executed, if selectors actually selected something and if those elements are what you look for.

    PS: would be nice if you set a nicer nickname for your profile, just to be more like a human

  • Steelbird
    Steelbird Rank 4 - Community Specialist

    Hi Gianni,

    Particular dashboard is the Custom Dashboard. I am not going to change the OOTB dashboards. I want those colors to appear on Custom Dashboard only.The above three methods which I google from different blogs. Those code are worked for them. None of the codes did not worked out for me.

    The dashboard consists of 15 pages. I am trying to add text in dashboard page & marked it as HTML code and execute report. but it did not worked out.

    I used browser developer toolbar and added css code. I will look into JQuery and work on this one.

    Thank you.

  • Just giving you a hint (as it make little sense to copy/paste a piece of code without understanding it...).

    $(function() {  $("#dashboard_page_0_tab").parent().parent().children().each(function(i) {    $(this).css("background-color", "red");    //console.log(i);    switch(i) {      case 0:        // first tab        $(this).css("background-color", "red");        break;      case 1:        // second tab        break;      // etc.    }  });});

    0 = first page of the dashboard, 1 = second page of the dashboard etc.

    It seems to work for the tabs not being active, so for the active one you will have to use a special logic (I imagine some CSS are conflicting with just setting the color at that level).

    As you already saw the classes masterTabBarTabSecondarySelected, secondaryTabSelected or tabContainerSelected will allow you to select that tab and treat it as required (you can couple that check with the above loop so that you keep your pages logic properly).

    (I used OAC 105.3 for the test, not 12.2.1.4, therefore there could be some differences already)

  • Steelbird
    Steelbird Rank 4 - Community Specialist

    Hi @Gianni Ceresa,

    Thank you. I will check and update you.