createComponent(meta, dataSource, index, additionalPropsToComp)
Creates a component whose type is provided as part of the meta object and uses the other parameters to resolve the properties and get the context.
Returns
A newly created instance of a component.
Parameters
Name | Type | Description | Required |
meta | object | The metadata of the component to be created. | ✅ |
dataSource | string | The source reference to the Redux store. This contains properties that will be input to the created component. | ✅ |
index | string | If the dataSource is a list, this is the index position that will be input to the created component. | ✅ |
additionalPropsToComp | object | The additional properties that are passed as input to the created component apart from the configured values. | ✅ |
Usage example
In this example, a button is created with a label that is derived from the first
index position of the D_Employees.pxResults
list.
getPConnect().createComponent({
type: "Button",
config: {
label: "@P .FirstName"
}
},
"D_Employees.pxResults",
1,
{
active: true
}
);
Previous topic clearErrorMessages(errorMsgConfig) Next topic deRegisterAdditionalProps(deRegisterKeys)