Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
The SelectedRowsChanged event is launched even if the selected row is not changed from a grid, but just after a refresh of the service returning the data.
This is what happen (note thantI switched from TWX 8.2 to 8.5):
I have a mashup with a service returning an infotable.
I put this data into a grid, and here it is possible to select a row
I also have a refresh widget that calls every 30 seconds the service, just to to update values
Now I select a row, and correctly SelectedRowsChanged is launched.
After some time when the refresh widget triggers and launch the service, I also get the SelectedRowsChanged event, even if I didn't changed it from the grid.
It happen with both classic grid and also grid advanced.
With TWX 8.2 this was not happening.
Can this be fixed without doing other tricks ?
Solved! Go to Solution.
hello Constantine
it would be even more simple, with just an EXPRESSION with a single input "InValue" linked to a field of the SelectedRow, and the expression code will be just "InValue;" (output will be a copy if the input), with autoevaluate=true
I use the "Changed" event of the EXPRESSION instead of the SelectedRowChanged event of the main service
This works, but it is a trick ...
If you haven't yet, try assigning a primary key to one of the fields (or combo of fields) of the datashape of the output.
This is just a stab in the dark to see if it might resolve your issue.
What it should accomplish is retention of selectedrow on a refresh.
There is already a Primary Key, so the PK does not fix the problem
Hello @iguerra,
Here's an example of how you can do it. The grid refreshes every 5 seconds, while the expression doSomethingOnRealSelectionChange fires only when the selection actually changes.
The approach I used here is to compare the old selected value with the new one, using an intermediate expression (oldValue) to create a logical delay between two actions. To make it work you'll need to have some unique key in your data, as @PaiChung suggests.
Obviously I don't imply that it's the right way to do it, but it might solve your issue while you're waiting for feedback from PTC R&D or Tech Support.
Regards,
Constantine
hello Constantine
it would be even more simple, with just an EXPRESSION with a single input "InValue" linked to a field of the SelectedRow, and the expression code will be just "InValue;" (output will be a copy if the input), with autoevaluate=true
I use the "Changed" event of the EXPRESSION instead of the SelectedRowChanged event of the main service
This works, but it is a trick ...
Ah yes, you're right -- it has this "Data change" selector, so it won't fire every time, but only when the value changes. Didn't think about it early in the morning
/ Constantine
Yeah ...
Do you think I should wait a feedback from PTC R&D or Tech Support ?
Or should I open an official support ticket
this strange behaviour of unwanted "changed" event happen also on Session variables: if a session var is updated the with the same value, I got the unwanded datachanged event ... I had to fix with the same Expression trick.
I thougth that the "internal method" for the datachange was set as "always" instead of "change" ... but it is strange, may be this is another bug...