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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Issue with RowClicked and LastClickedRow on thingworx grid widget

JK_10744682
8-Gravel

Issue with RowClicked and LastClickedRow on thingworx grid widget

Hi all,

 

Experiencing a weird issue with the gris widget that I'm hoping someone can help me with. 

JK_10744682_0-1732024713357.png

I have a grid widget where when I click a row I want it to populate a mashup parameter for a popup and navigate to the popup. It works normal and as expected on the first click, but when exiting the popup and clicking another row, it shows the MashupParameters as undefined. I can't figure out why it works the first time, but doesn't any time afterwords. I also tried using the SelectedRowsChanged and allowing a row to be selected and had the same issue. Any ideas on this?

ACCEPTED SOLUTION

Accepted Solutions

Weird! I have a few ideas, but no obvious solution...

 

First, let's look at the popup... Try to change the Navigation type to the "normal" window, not a popup. This way it will open a new page and will pass all parameters to this mashup via HTTP GET query parameters. In other words, you should see the content of that infotable in the URL. Please check it and tell us if it's there or not.

 

Second, what if you create a new pair of "minimal" mashups, and only put that logic in them? In other words, can you try to have a minimal reproducible example? If it works (hopefully!) then you can check the difference between your "real" mashup and that. If it doesn't -- you can submit it to PTC Support.

 

Third, assuming it's a problem with mashup parameter TYPE, i.e. the fact that your MashupParameters is an INFOTABLE. What if you convert it to JSON, and pass as a JSON, or a JSON.stringify() even? Then, on the receiving side you'd have a few expressions, which "convert" it back to individual values (one Expression per column). To convert INFOTABLE to JSON you can try this trivial extension, I hope it still works with the latest ThingWorx: https://github.com/vilia-fr/twx-infotable-to-json-ext

 

Fourth, assuming nothing else works. You can bind your clicked or selected row to a Session parameter, and access it from your popup. Gotta be careful, as this will create side effects, will make your code harder to read and maintain, and will also trigger a REST call to save this dummy session parameter on the server side, too.

 

Update (just thought about it) -- before doing any of that, try to bind individual attributes from Selected Row(s) to individual mashup parameters, so that you don't need to deal with INFOTABLE parameter:

Constantine_0-1732115056315.png

 

/ Constantine

View solution in original post

6 REPLIES 6

Hello,

 

I have no idea if that will help or not, but with your "selection" approach, try to bind Selected Rows from the data source (not from the grid) to this Navigation.

 

/ Constantine

Thanks for the suggestion, this still seems to cause the same issue though unfortunately 

Weird! I have a few ideas, but no obvious solution...

 

First, let's look at the popup... Try to change the Navigation type to the "normal" window, not a popup. This way it will open a new page and will pass all parameters to this mashup via HTTP GET query parameters. In other words, you should see the content of that infotable in the URL. Please check it and tell us if it's there or not.

 

Second, what if you create a new pair of "minimal" mashups, and only put that logic in them? In other words, can you try to have a minimal reproducible example? If it works (hopefully!) then you can check the difference between your "real" mashup and that. If it doesn't -- you can submit it to PTC Support.

 

Third, assuming it's a problem with mashup parameter TYPE, i.e. the fact that your MashupParameters is an INFOTABLE. What if you convert it to JSON, and pass as a JSON, or a JSON.stringify() even? Then, on the receiving side you'd have a few expressions, which "convert" it back to individual values (one Expression per column). To convert INFOTABLE to JSON you can try this trivial extension, I hope it still works with the latest ThingWorx: https://github.com/vilia-fr/twx-infotable-to-json-ext

 

Fourth, assuming nothing else works. You can bind your clicked or selected row to a Session parameter, and access it from your popup. Gotta be careful, as this will create side effects, will make your code harder to read and maintain, and will also trigger a REST call to save this dummy session parameter on the server side, too.

 

Update (just thought about it) -- before doing any of that, try to bind individual attributes from Selected Row(s) to individual mashup parameters, so that you don't need to deal with INFOTABLE parameter:

Constantine_0-1732115056315.png

 

/ Constantine

Thanks for the further information. I found that point one worked and the data populates correctly when having the mashup open as a new window rather than a popup, however this doesn't solve my issue really since I want it as a popup. It doesn't really make sense why a popup versus a new window would cause issue like this, so my team will be creating a ticket as we believe this may be a bug.

If you bind individual attributes from Selected Row(s) (not the entire Infotable), this might solve the issue, so that you won't need to wait for the Support.

 

/ Constantine

Strangely enough, even this method shows the individual values as undefined in the same way the infotable does.

Announcements


Top Tags