cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get and modify Widget's properties in javascript in a service?

Highlighted
Visitor

How to get and modify Widget's properties in javascript in a service?

Hi all,

- Does anyone know if it is possible to get/modify widget's properties in javascript in a service?

I'm currently working with a big mashup as the following:

I want to change the circles colors to red or green whenever a user click on it. And I also want to save the colors data (or just numbers) so the mashup could always show those colors.

Any help?

Thanks,

De  Hong

4 REPLIES 4

Re: How to get and modify Widget's properties in javascript in a service?

Could you put a transparent button (no background/foreground colour above the circle (Z-index). When it is clicked it calls a service that toggles the state of a property and sets it. Then you could use state definition on that property to decide the colour of the circle.

Re: How to get and modify Widget's properties in javascript in a service?

Hi Kieron,

Thanks for the reply. Yes, this is indeed a possible solution. However, there are 147 circles, which means that I need to create 147 services to change the state of 147 properties. I wanted to do it in a more automated way like a service that indentify the widget id and change its parameters and properties.

Re: How to get and modify Widget's properties in javascript in a service?

Hi,

are you familiar with the repeater widget? This widget will display any number of smaller mashups inside itself. I would suggest you do it using this widget,

 

Here is part an example

Each of the similar pictures above is a single mash up repeated many times. The repeater widget takes a mash up name as an input parameter

The number of items it displays (repeats) is determined by a GetImplementingThingsWithData( ) type service. You could write your own so long as it returns an infotable with the data you require for each single mash.

Doing this way you can create a mash up that is just one of your rectangles

then use the repeater widget to display the mashup below. The beauty of this way is that you would only have to write 3 services (one for each circle above). also you would not have to change your 'big' mash up if the number of things (each rectangle represents) changes in future.

Look into how to use repeater widgets if you aren't familiar with them. There is a video which explains it better than I can

https://www.youtube.com/watch?v=zXrKq1tvntU

Good luck

Re: How to get and modify Widget's properties in javascript in a service?

I should have added that the way to pass the data to each small mashup is via mash up parameters. So for the example above I have the parameters shown below.

Note you can make each mashup selectable.

I haven't tried it, but hopefully this would mean you can click a button in the smaller mash up. One slight drawback is that the loading speed for the whole page can suffer, but it shouldn't be to bad.