Hi everyone,
I'm currently working with the GridAdvanced widget in a ThingWorx Mashup and I’ve encountered a behavior that I’d like to improve.
The grid is populated correctly, and I’ve set the DefaultSelectedRow property to 1, so when the mashup loads, the first entry is automatically selected — which works as expected.
However, here's the issue:
When I select a different row, make some changes, and then refresh the grid (e.g., by re-binding the data), the grid resets to the default selection (row 1) instead of staying on the row I had selected and updated.
This causes a disruption in the workflow, especially when users want to immediately view the changes they made to a specific entry without having to re-select it again manually.
Is there a recommended way or workaround to preserve the selected row in the GridAdvanced widget after a refresh, so that the grid does not jump back to the default selection?
Any advice, workaround, or guidance would be greatly appreciated!
Thanks in advance,
Solved! Go to Solution.
Hi @MA8731174,
One way to achieve preserving the selected row in grid after refresh would be using Session parameter to temporarily store the user selected row before refresh and populate this value to Grid's SelectedRow after refresh.
Check out Help Center for more information on Session Parameters
Flow is sth like below:
Refresh Button Click
↓
Trigger JS service say "RecordSelectedRows" to store the current selected row(s) in session parameter with Resources["CurrentSessionInfo"].SetGlobalSessionInfoTableValue({name: <SessionParaName> ,value: <SelectedRows_InputFromGrid>})
↓
Upon "RecordSelectedRows" ServiceInvokeCompleted, trigger service say "GetGridData" to refresh the grid data
↓
Upon "GetGridData" ServiceInvokeCompleted, trigger another JS service say "GetPreviousSelectedRows" to get the session parameter value using Resources["CurrentSessionInfo"].GetGlobalSessionValues().<SessionParaName>
↓
Bind the Returned Data of "GetPreviousSelectedRows" to SelectedRows of the Grid
Best,
Hi @MA8731174,
One way to achieve preserving the selected row in grid after refresh would be using Session parameter to temporarily store the user selected row before refresh and populate this value to Grid's SelectedRow after refresh.
Check out Help Center for more information on Session Parameters
Flow is sth like below:
Refresh Button Click
↓
Trigger JS service say "RecordSelectedRows" to store the current selected row(s) in session parameter with Resources["CurrentSessionInfo"].SetGlobalSessionInfoTableValue({name: <SessionParaName> ,value: <SelectedRows_InputFromGrid>})
↓
Upon "RecordSelectedRows" ServiceInvokeCompleted, trigger service say "GetGridData" to refresh the grid data
↓
Upon "GetGridData" ServiceInvokeCompleted, trigger another JS service say "GetPreviousSelectedRows" to get the session parameter value using Resources["CurrentSessionInfo"].GetGlobalSessionValues().<SessionParaName>
↓
Bind the Returned Data of "GetPreviousSelectedRows" to SelectedRows of the Grid
Best,
Hi @MA8731174,
It appears that a response to this post answers your question. For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.
In the event that this response did not answer your question, please post your current status so that we can continue to support.
Thanks for using the PTC Community!
Regards,