-
I've initialized the data-change-listener-plugin and have what I think is a reasonable listener, but I can't get anything to trigger. does anything look "off"? import { ReactPlayer, Flow } from "@player-ui/react";
import { ReferenceAssetsPlugin } from "@player-ui/reference-assets-plugin-react";
import { CommonTypesPlugin } from "@player-ui/common-types-plugin";
import { CommonExpressionsPlugin } from '@player-ui/common-expressions-plugin';
import { DataChangeListenerPlugin } from "@player-ui/data-change-listener-plugin";
import {
ExternalActionPlugin,
ExternalStateHandler,
} from "@player-ui/external-action-plugin";
...
const reactPlayer = new ReactPlayer({
plugins: [
new ReferenceAssetsPlugin(),
new CommonTypesPlugin(),
new ExternalActionPlugin(externalActionHandler),
new DataChangeListenerPlugin(),
new CommonExpressionsPlugin()
],
}); Here are a few slices of my flow. ...
listeners: {
// "dataChange.application.address.zip": "{{application.address.city}} = 'foo'"
"dataChange": "setDataVal('application.address.city', 'fort worth')"
},
...
{
asset: {
id: "get-started-address-zip-input",
type: "input",
label: {
asset: {
id: "get-started-address-zip-input-label",
type: "text",
value: "Zip",
},
},
binding: "application.address.zip",
},
}, I've tried referencing functions that don't exist, different fields, etc., can't even trigger an error. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Your example looks to be correct -- here's an example of the data-change listener in a codesandbox using the first listener you had: Once the input is changed, and the data set in the model ( |
Beta Was this translation helpful? Give feedback.
Your example looks to be correct -- here's an example of the data-change listener in a codesandbox using the first listener you had:
https://codesandbox.io/s/player-react-intro-forked-g4dk39
Once the input is changed, and the data set in the model (
onBlur
), the value ofapplication.address.city
is updated