cancel
Showing results for 
Search instead for 
Did you mean: 

Changing StyleSheets using BW WAD

Former Member
0 Kudos

Hi BW Gurus,

I have different Materials in my report, when user drill downs on paticular material for e.g. My material is Laptop X, It should show me the image of Laptop X and the report should contain different color format for the paticular material (laptop X) . Right now I have only one style sheet, but our requirement is to customize each and every report based on materials.

Is there anyway, i can change the default stylesheet based on the material user selected. If anyone of you done this before please help me. I was thinking to manipulate using Javascript but i have no idea how that will work.

Thanks for anykind of help.

Deepak

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

changing the CSS on runtime by JavaScript is very simple :

1. Be sure, that your <LINK rel="stylsheet" ...> to your default-stylesheet has any ID, maybe <LINK rel="stylsheet" ... ID="css">

2. change the stylesheet in a JavaScript-function by :

document.getElementById("css").href="ThePathToTheStyleSheetYouWant";

All you have to do now is to determine, what stylesheet do you want to show, so you have to create any JavaScript like :

function changeCSS(material)

{

var CSSName;

switch(material)

{

case MATERIAL_1 :

CSSName = PathToStyleSheet4Material1;

break;

case MATERIAL_2 :

CSSName = PathToStyleSheet4Material2;

break;

...

}

document.getElementById("css").href=CSSName;

}

Fill it with your requirements, you can choose you CSS by array or switch-case or function or .....

But - are you sure, that you have to maintenance a lot of style-sheets, in the worst-case for every material another CSS ?????

Bye

Ralf

Former Member
0 Kudos

Hi Ralf,

Thanks alot you really helped me.

I think we gonna maintain different stylesheets for every material. As of now we have only 10 main materials where we need to change the stylesheets.

Thanks,

Deepak

Answers (0)