my question is how do i associate a variable in the parente with the input parameter of the block that will trigger on parameter changed
Hi @Bernardo Cardoso ,
Any Input Parameter of the block changing from the parent can trigger the block’s On Parameters Changed event.
In the parent screen, you bind the parent variable directly to the block’s Input Parameter from the block. On Parameters Changed does not run just because you assign something inside the block. It runs when the parent changes the value passed into the block input.
To make On Parameters Changed fire, you just need to bind a parent variable to the block’s input parameter and then change that variable in the parent.
Create the variable in the parent
SelectedProductId
Add the Block to the parent
Bind the variable to the Block input parameter
ProductId
ProductId = SelectedProductId
Change the variable in the parent
SelectedProductId = <NewId>
In summary: Associate = set Block.InputParam = ParentVariable in the Block’s properties, then change ParentVariable in your parent logic.
On the parent Screen (or parent Block), that step is done directly in the Block instance’s Properties:
Enabled
EnabledVar
Example:
Enabled = EnabledVar
That’s the “association”: you’re binding the Block’s input parameter to the parent’s variable via the value expression in the Block instance properties. When you later change EnabledVar in a client action on the parent, the Block’s Enabled input changes, and OnParametersChanged will fire. On Parameters Changed
Hi,
I attached an image showing how a variable is associated with a child webblock's input parameter. You can do this by following below steps.
1. Create an input parameter on the child block
2. Place the child webblock inside the Parent block
3. Once the child webblock is inside the parent block, click and you will see the input parameter on the right side of your screen.
4. Assign the parent local variable to that input parameter
After doing this, everytime the parent local variable change its value, the OnParameterChanged event will be triggered inside the child web block. Let me know if you need more clarity.
Hi.
Every input parameter in a block, when changed in the parent, will trigger the OnParametersChanged action.
If you want that just one parameter triggers that action, I have a solution for you.
You have to replicate that input variable in a local one. In the OnReady event, you set that local variable equal to the input one. In the OnParametersChanged, you check if those variables are equal. If not, you refresh the data action and, again, set the local variable equal to the input one.
If you have any questions, please let me know.
Hi u can set input param of Screen for input param of Child Block
when input param of Screen changes, the child block will trigger OnParameterChange() in block.
And if u want to change data in screen from block, u can create event in block and handle this event on screen.
Note that all the valid answers are for Reactive only. If you have the misfortune to work with Traditional, you'll need to Ajax Refresh the Web Block (or a container it's enclosed in) befor the On Parameters Changed will trigger.