First, what I am trying to do is open a popup view and pass two parameters to it when a user selects a cell in a Perspective table (enableRowSelection
and enableColumnSelection
are both true). I have configured a Script Action in the onSelectionChange
component event to accomplish this, and it works... mostly.
One of the parameters comes from the table's props.selection.data[0]
, whose value I am getting on its own by adding .values()[0]
; I am calling this the piece
. The other parameter is a Custom property called section
that looks for the piece
in a different custom property (whose data is static) and returns a correlated string value.
The issue I'm having is that the section
property being pulled into the onSelectionChange
script action is delayed by one selection change. In other words, when I select a cell in a running session, the piece
property populates with the newly selected cell value like it should, but the section
property is populated with the value associated with the previous cell selection. For example, in a new page with the table, with nothing selected, when I select a cell for the first time, piece
becomes piece1
like it should, but section
remains null
, when it should be section1
. When I select a new cell, piece
becomes piece2
, and section
becomes section1
, when it should be section2
. This pattern continues with all additional selections.
I considered the possibility of onSelectionChange
being the wrong event for triggering the action, but onClick
won't even open a popup at all, and I am getting 1 of 2 properties like I expected, so I feel like the issue lies elsewhere.
Any guidance is appreciated.
Thank you.