Skip to main content
16-Pearl
February 28, 2020
Solved

SelectedRowsChanged issue

  • February 28, 2020
  • 2 replies
  • 3187 views

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 ?

 

 

Best answer by iguerra

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 ...

 

2 replies

22-Sapphire I
February 28, 2020

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.

iguerra16-PearlAuthor
16-Pearl
March 2, 2020

There is already a Primary Key, so the PK does not fix the problem

18-Opal
March 2, 2020

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

iguerra16-PearlAuthorAnswer
16-Pearl
March 2, 2020

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 ...

 

18-Opal
March 2, 2020

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