do you think is possible to develop a widget that implements a for loop?
for example, if I have an integer n as output of a first widget and I want to execute n times an operation of a second widget...
This topic has been locked.
5 replies Latest Post - 2009-10-08T14:35:59Z by SystemAdmin
Pinned topic a "For Loop" Widget...is it possible?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2009-10-08T14:35:59Z at 2009-10-08T14:35:59Z by SystemAdmin
Re: a "For Loop" Widget...is it possible?2009-09-24T13:58:30Z in response to SystemAdminIt's not clear what you mean by executing the operation of a widget. A widget is a UI device, not an operation. Do you mean you want the second widget to show up in the page N times? And do what? Do you mean that an operation associated with it will be executed N times? More specifics will get you a better answer.
Re: a "For Loop" Widget...is it possible?2009-09-24T14:44:14Z in response to SystemAdminThank you for the answer. I'll try to be more specific with this example.
I have two widgets. The first widget gives me back an ID list...the second widget has one Id as input, performs a web service call and shows results.
This is what I need: I'd like to perform the web service call for each of the ID in the list and show the whole set of results.
I think that with a for loop I can solve this problem...I could index the IDs in the list and use a for loop to repeat the send event many times as are the IDs.
Re: a "For Loop" Widget...is it possible?2009-09-24T16:01:46Z in response to SystemAdminGot it.
Build the HTML around the second widget so that there is an obvious element to repeat. Perhaps just a DIV, or maybe something like.
<table> <tr name= "RepeatThis"> <td><span name= "widgetHere"/></td> </tr> </table>
Put a Repeated Region builder on the RepeatThis element, repeating over the data from the first widget and defining a loop variable.
Set up the second widget so that it is based on the loop variable.
You probably want to make this into its own widget, so that the data it receives is a list of IDs. Then you wire this to the first widget using standard widget wiring tools.
Re: a "For Loop" Widget...is it possible?2009-10-06T07:52:00Z in response to SystemAdmin...mmm...ok...I've used a Repeated region builder and now I have in each row one ID of the list...
The scope of this widget sould be to send sequentially the IDs to the second widget...I've tried an HTML Event Action builder and I can send a single ID of from the table using onMouseOver or Onclick etc...but I can't send them one after the other, with no clicking, during the rendering of the table...
any other suggestion? probably the second part of your post wasn't clear to me...
Re: a "For Loop" Widget...is it possible?2009-10-08T14:35:59Z in response to SystemAdminI've had to do something similar for another project, and was able to put together some quick sample models that show two ways to do this. One of these fires an event multiple times on the server; another uses a repeated-region-like approach. Firing events on initial widget load is dangerous because of timing issues (are you guaranteed that the target widget is initialized in time?)