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

How to refresh a collection widget or contained mashup based on data change from a pop-up?

SOLVED
eribbeck
Regular Member

How to refresh a collection widget or contained mashup based on data change from a pop-up?

Here is the situation:

  • I have a mashup that is essentially just a collection widget
  • I am using a service (getCollectionWidgetData) to populate the collection widget
  • Each row in the collection is a contained mashup which has some action buttons on it that allow the user to kick-off other services (when clicked, each button launches a pop-up for the user to confirm, then when confirmed the service is executed and pop up closed - so technically the service is executed from the popup mashup)
  • Each row in the collection is also displaying data that should change based on those services being executed

Here is what I have tried:

  • I created a global session variable named "refreshCollection" as a BOOLEAN
  • when one of the above services is ServiceInvokeCompleted, I am then calling SetGlobalSessionBooleanValue({ name: "refreshCollection", value: true })
  • on the mashup with the collection widget, I am executing getCollectionWidgetData based on the refreshCollectionChanged event
    • I have also tried executing the GetGlobalSessionValues service first, but I don't know what event to trigger this service to run

Here is what is happening:

  • getCollectionWidgetData is never triggered to run again unless the user navigates away from the mashup and back to it
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to refresh a collection widget or contained mashup based on data change from a pop-up?

Hello @eribbeck ,

 

There's a trick involving Validators and Expressions, which allow you to convert values to events.

 

Try to create a Validator, which takes this boolean as a parameter and bind its True event to your service. In the validator just return true. The crucial bit here is to select "Output = false" (like this it won't fire at the beginning), and "Auto evaluate = true" for the obvious reason.

 

If that doesn't work for some reason -- try to replace your BOOLEAN value with a NUMBER, which you generate randomly every time.

 

Finally, instead of executing services Get... / SetGlobalSessionBooleanValue try to assign those session variables directly via bindings in mashup, they support bi-directional bindings. This way you can avoid doing a server round-trip and everything should happen inside the browser.

 

We use those techniques to do exactly what you're describing -- refreshing a collection from inside a popup, so you seem to be on the right path.

 

Regards,
Constantine

View solution in original post

3 REPLIES 3

Re: How to refresh a collection widget or contained mashup based on data change from a pop-up?

Re: How to refresh a collection widget or contained mashup based on data change from a pop-up?

Hello @eribbeck ,

 

There's a trick involving Validators and Expressions, which allow you to convert values to events.

 

Try to create a Validator, which takes this boolean as a parameter and bind its True event to your service. In the validator just return true. The crucial bit here is to select "Output = false" (like this it won't fire at the beginning), and "Auto evaluate = true" for the obvious reason.

 

If that doesn't work for some reason -- try to replace your BOOLEAN value with a NUMBER, which you generate randomly every time.

 

Finally, instead of executing services Get... / SetGlobalSessionBooleanValue try to assign those session variables directly via bindings in mashup, they support bi-directional bindings. This way you can avoid doing a server round-trip and everything should happen inside the browser.

 

We use those techniques to do exactly what you're describing -- refreshing a collection from inside a popup, so you seem to be on the right path.

 

Regards,
Constantine

View solution in original post

Re: How to refresh a collection widget or contained mashup based on data change from a pop-up?

Thank you, moving away from using the Get / Set services seems to be the trick. Writing directly to the session parameters is working much more consistently.

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.