Quantcast
Channel: SCN : Discussion List - SAP BusinessObjects Design Studio
Viewing all articles
Browse latest Browse all 4041

Call a setter from Script Contributions

$
0
0

Hey guys.

 

I've recently started to expose some API's through the Script Contribution of my component, and thus to learn how it is working.

Sadly, I begin to understand some concept behind it and I can't achieve what I want to do.

 

Let's say, I have a component which displays 5 boxes (technically, 5 divs).

I want to be able to hide/show boxes according to their id.

 

For this, this is what I've made :

 

Component.js :

this.setVisibility = function(boxId, visibility) {   if (visibility) {     $("#"+boxId).show();   } else {    $("#"+boxId).hide();   }
}

 

Script Contribution :

void setLayerVisibility(String layerName, boolean visibility) {*  this.setLayerVisibility(layerName, visibility);
*}

And in my report, I've just created a simple checkbox, and gave it a name according to one of the boxes id

 

MAP_1.setVisibility(CHECKBOX_1.getText(), CHECKBOX_1.isChecked());

I've also added a property in my contribution.xml file, but I don't know if it's necessary and I'm not sure if I did it well, because I don't know which type I have to chose.

 

<property id="setVisibility"  title="Visibility"  type="String" (????) visible="false" />

 

When trying to make it run, I got a "Error while script processing", followed by a "Exceeded maximum stack depth setVisibility#2" in the Error console of Design Studio.

 

 

 

From what I understand looking at some other custom component code, I can't do a "this.setLayerVisibility(layerName, visibility);" in the Script Contribution because this is executed on server-side. Thus the title of my question.

 

How could I achieve this in a proper way ?

I don't want to do a

 

this.id = "id1";
this.visibility = true/false;

if it's possible , I would like to avoid that for some technical reasons (my properties store JSON stringified description of boxes).

 

Anyway, any tips/help about Script Contributions are welcome !

 

Thanks

 

Br,

Vincent


Viewing all articles
Browse latest Browse all 4041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>