Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi,
wondering if there is a way to pass a button click in a collection widget cell mashup to the collection widget refresh.
I have a list of items displayed in a collection widget. There is a 'delete item' button in each item's cell mashup. I'm looking for a way to pass the click event on the button back to the collection widget itself so that it can redraw itself with the new list (minus the deleted item).
Currently I manage this by having the delete button set a boolean session parameter to true. In the main mashup I have a timer running (every second) which checks the state of the boolean & if true redraws the collection widget (list). It works, but seems clunky, so would prefer a way to pass the button click in the cell back to the collection widget without having to use a timer. I did try tying a validator to the session parameter, but it didn't appear to trigger when the session boolean changed.
TIA
K
Solved! Go to Solution.
No need to use that. In the Cell Mashup define an Expression which outputs new Date(), guaranteed to always change.
Create a new Session variable named CollectionRefresh, type DateTime. Make the Delete button call the Evaluate service of the Expression. In the host mashup, the CollectionRefresh Session variable will have a CollectionRefreshChanged event -> bind that to the service that refreshes the infotable.
I believe there might be an alternative way with the collection events that are generated from the input global parameters, just didn't try that in while.
Note:In reality you just need to setup the Session variable to "Always" and use any result in that expression.
No need to use that. In the Cell Mashup define an Expression which outputs new Date(), guaranteed to always change.
Create a new Session variable named CollectionRefresh, type DateTime. Make the Delete button call the Evaluate service of the Expression. In the host mashup, the CollectionRefresh Session variable will have a CollectionRefreshChanged event -> bind that to the service that refreshes the infotable.
I believe there might be an alternative way with the collection events that are generated from the input global parameters, just didn't try that in while.
Note:In reality you just need to setup the Session variable to "Always" and use any result in that expression.
Since session variables are global they are harder to manage. Is there a way to achieve this without session variables?
Yes, you can use the globalPropertyBinding property of the collection widget. In there, define a DeletedPropertyId property of whatever type your id is. It will look something like this.
{
"DeletedPropertyId": "STRING"
}
Inside your cell mashup, define a mashup parameter with the same name and type as the one you defined in your global properties. Also in your cell mashup, create an expression which returns the propertyId and have it evaluate only when you click the delete button. Bind that expression output to your "DeletedPropertyId" mashup parameter.
Inside you containing mashup(where you have the collection widget) you will see that the "DeletedPropertyId" is available in the collection widget, just like any other bindable property. Make an expression there that takes "DeletedPropertyId" from the collection as input and just returns it. Bind the "Changed" event from the expression to the delete service, so that it gets called each time the "DeletedPropertyId" changes. Notice that for this to happen, the delete service needs to be defined at the containing mashup level and no longed at the cell mashup, like you did before.
Lastly, bind the service invoke complete of your delete service to the service that pulls the data to be displayed in the collection.
Thank you for your step
I'm find same concept and I can develop when follow your step
I need to click button in cell mashup (Selected cell) to Expand container (show detail of Selected cell) in contain mashup
in contain mashup collection widgets
Add MashupGlobalPropertyBinding
{
"SelectedThing": "STRING"
}
Add expression for check SelectedThing data change
Add expression to reset if click Collapse container
Add validator for check SelectedThing != "" (true for Expand container)
in cell mashup
Add Mashup paremeter SelectedThing
Add expression for get SelectedThing (output = SelectedThing in Mashup paremeter)
note: If Expression - Data Change Type is Value it's not work, but change to Always i's work